I have a Spring Boot REST application and want to create a swagger for it.
It works fine, the swagger loads without problem.
Now I want to be generic and flexible at the same time:
- First priority is to load swagger related JS and CSS files in the HTML from the web
- I also store the swagger related JS and CSS files in the source code
- So when the application loads, I want to load the files from the internet AND only if it fails then load them from the source as a fallback.
This solution works fine for JS, because I use this way (loads the JS first from source and then overrides from the internet if it can be found):
<!-- swagger-ui-bundle.js -->
<script src="swagger/js/swagger-ui-bundle.js"></script>
<script src="https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js"></script>
<!-- swagger-ui-standalone-preset.js -->
<script src="swagger/js/swagger-ui-standalone-preset.js"></script>
<script src="https://unpkg.com/swagger-ui-dist/swagger-ui-standalone-preset.js"></script>
But it does not work for CSS, I tried this way:
<!-- swagger-ui.css -->
<link rel="stylesheet" type="text/css" href="swagger/css/swagger-ui.css">
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist/swagger-ui.css">
Is it possible to define a priority for loading CSS files in HTML? Please give me some examples. Thanks!