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

Add --no-inline build flag (for CSP compatibility) #593

Open
andreasvirkus opened this issue Feb 17, 2020 · 1 comment
Open

Add --no-inline build flag (for CSP compatibility) #593

andreasvirkus opened this issue Feb 17, 2020 · 1 comment

Comments

@andreasvirkus
Copy link
Contributor

Feature request

What problem does this feature solve?

It would allow users to keep very strict CSP directives (since the output is often a simple static site) by removing inlined styles and base64-inlined images.

What does the proposed API look like?

Maybe a --no-inline flag passed in to saber build?

How should this be implemented in your opinion?

When the flag is present, CSS should be written to their own files instead of being inlined in the document's <head>, same for images (maybe this can already be avoided by using saber-image, I've yet to test that?).

Are you willing to work on this yourself?

Yes, with some guidance 🙏


Sorry if this is already somehow solvable by existing features.

@egoist
Copy link
Collaborator

egoist commented Apr 18, 2020

You can manually modify webpack config but it's kinda verbose, we can add new build option (https://saber.land/docs/saber-config.html#build) to control this. Similar to this option (https://poi.js.org/config.html#assets-inlineimagemaxsize) in Poi.

CSS can already be extracted https://saber.land/docs/saber-config.html#extractcss

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

No branches or pull requests

2 participants