Skip to content

CSS boilerplate #465

Answered by cossssmin
daniel-thisnow asked this question in Q&A
May 10, 2021 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

This is actually caused by the Juice inliner, not purgeCSS or removeUnusedCSS.

Juice already has a way of preventing inlining (2), but maybe it could benefit from an option that prevents inlining matched CSS selectors. Kind of like how safelist works in PurgeCSS.

For now there are a few ways around it. In no particular order:

1. Disable removeStyleTags

removeStyleTags is turned on by default in the CSS inliner - this option removes the original <style></style> tags contents after (possibly) inlining the CSS in them. You can disable it like this:

// config.production.js

module.exports = {
  inlineCSS: {
    removeStyleTags: false
  },
}

Note that this will result in other CSS resets like …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@cossssmin
Comment options

@daniel-thisnow
Comment options

Answer selected by daniel-thisnow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants