redoc
redoc copied to clipboard
redoc-cli serve does not load assets
I would like to use redoc-cli serve
while developing to see live updated to my site. However non of my images are loading. They all live in the same directory as where I call redoc. My dir structure is
/openapi
openapi.yaml
/assets
logo.png
template.hbs
From this directory I call:
@npx [email protected] serve openapi/openapi.yaml --watch -t template.hbs
Any way of making the images show up?
Hello! you can create a symbolic link to assets in docs/assets/images/
Thanks for your answer. I created docs/assets/images folder and moved all my images there however this unfortunately did not solve my issue. I had a brief look at the code and it seems that the request for images would fall into this else statement are return 404. https://github.com/Redocly/redoc/blob/5bace3008fa35c61d027eb621474246804fc4fcf/cli/index.ts#L190
Also with your solution what would the path be relative to?
I get the same issue looks like the server doesn't expose any local assets and I can't seem to find any options I can pass as an argument to serve
.
@ozeranskiy what did you mean by "creating a symbolic link"?
You can embed the logo in base64 then it will load correctly, e.g.,
x-logo:
url: 'data:image/svg+xml;base64, ....base64 encoded here...'