Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Ability to embed logo and favicon directly into html via Base64 encoding. #807

Closed
zleonov opened this issue May 12, 2023 · 5 comments · Fixed by #878
Closed
Assignees
Labels
enhancement New feature or request

Comments

@zleonov
Copy link

zleonov commented May 12, 2023

It would be useful if SpectaQL could encode the logo and favicon directly in the resulting html file. The general use case is the same as the oneFile config option.

Here is an example html:

<!DOCTYPE html>
<html>
  <body>
     <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="sample red dot" />
  </body>
</html>

TL;DR:

In my specific case the generated documentation is deployed with our product on an application server. We have a very strict policy when it comes to exposing resources to the web. This requires putting images in one location, putting html files in a different location, configuring various settings, and so forth. To make it work we must manipulate the image paths in the resulting html file before deployment to match the location of the images on the application server.

While this can be automated, essentially this means we have to maintain two copies of the documentation. The original output, which we preview as we improve our documentation, and the output which gets deployed. Etc. Etc.

If there was a single file with everything embedded that would simply all these use cases.

@newhouse newhouse self-assigned this May 12, 2023
@newhouse newhouse added the enhancement New feature or request label May 12, 2023
@newhouse
Copy link
Collaborator

Feels reasonable to me

@BadgerBadgerBadgerBadger

To add to this. I have a similar usecase where providing a URL instead of a file path would solve my issue.

@newhouse
Copy link
Collaborator

Support for this is coming today @BadgerBadgerBadgerBadger @zleonov

You will be to supply a embedLogo and embedFavicon booleans to your config. If true and logo/favicon file was provided, it will be embedded as Base64 rather than loaded as a local resource from the images/ directory.

You can also provide a logoUrl/faviconUrl, which will take precedent over the above, and be used for the src/href, if provided.

@newhouse
Copy link
Collaborator

This is published in main and on NPM in v2.3.0.

https://github.com/anvilco/spectaql/blob/main/config-example.yml#L27

https://github.com/anvilco/spectaql/blob/main/config-example.yml#L47

@zleonov
Copy link
Author

zleonov commented Aug 25, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants