-
Notifications
You must be signed in to change notification settings - Fork 222
Description
Preface: Apologies if this is a noobish question, Frontend development is not my domain of expertise. :(
I cannot get Swagger-UI 3.x to load any 3.x swagger-ui-theme CSS. Rather, the default CSS theme is always being loaded. Using my browser's debug tools I can see the JS console is error free, and the theme-xxx.css I specify (using your instructions) is in fact being served to the browser.
Below is a Dockerfile and a couple BASH commands to replicate the issue quickly (all work on Linux or Windows + Cygwin + Docker Toolbox).
- Write the below lines into a file named
Dockerfile:
FROM swaggerapi/swagger-ui:v3.0.2
# mount an index file with the `<link rel="stylesheet" href="path/to/theme.css" />` one-liner
COPY ./index-feeling-blue.html /usr/share/nginx/html/index.html
COPY ./theme-feeling-blue.css /usr/share/nginx/html/css/theme-feeling-blue.css
EXPOSE 8080-
Use your favorite means to obtain your preferred 3.x theme CSS from this repo (in my case feeling-blue).
-
Obtain the swagger-ui
index.htmlvia this link (you may need to fix the paths to the swagger-ui js components) or from the docker image referenced in the first line:
docker pull swaggerapi/swagger-ui:v3.0.2
# use docker run to start a container using the swagger-ui image, and obtain its container id
$ docker run -d swaggerapi/swagger-ui:v3.0.2
<container_id>
# shell into the docker
$ docker exec -it <container_id> /bin/sh
/ # cat /usr/share/nginx/html/index.html- Put the theme CSS, Dockerfile, and custom index.html into a common directory, change into it, then run:
docker build -t <your_registry>/<your_image>:<your_tag> .
docker run -d -p 8080:8080 <your_registry>/<your_image>:<your_tag>- Goto http://localhost;8080 and observe that your desired theme is NOT loaded.