feat: juice ignore comments #578
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for using special CSS comments to skip inlining rules or declarations, and even entire files/style blocks.
Closes #387.
Ignore entire file
Add a
/* juice ignore */comment on the first line in your CSS to skip inlining the entire file or style block:Ignore next rule
Add
/* juice ignore next */before any CSS rule to skip inlining that rule:The
h1rule will not be inlined, but will be preserved whenremoveStyleTags: true. Thebodyandprules will be inlined normally.Ignore next declaration
Add
/* juice ignore next */inside a CSS rule to skip inlining the next declaration:The
colorandfont-sizewill be inlined, butfont-weightwill not. The rule with the ignored declaration will be preserved in a<style>tag whenremoveStyleTags: true.Ignore blocks of code
Use start/end comment pairs to ignore multiple rules:
The
h2andh3rules will not be inlined but will be preserved in a<style>tag whenremoveStyleTags: true. Theh1andh4rules will be inlined normally.