PostCSS plugin to define and output critical CSS using custom atRules, and/or custom CSS properties. Critical CSS may be output to one or more files, as defined within the plugin options or within the CSS.
Change primary property from critical to critical-selector
Add scope option for critical-selector to move a selector and all its children to critical CSS
Add critical-dest property for arbitrary alternate destination files
ouptputPath option for output directory
preserve option for removing/saving rules flagged as critical
minify option for minifying output with cssnano
Note/Question:
The scope value has the effect of dragging in related, but unnecessary group selectors. For example, if you use critical-selector: scope on .news-item, it may drag in a selector like .container:after, .news-item:after, .third-selector:after, ... {...}. I considered pulling out only the relevant selector, but wasn't sure if that might have unintended consequences or simply be a Bad Idea™. Currently it brings in the entire selector; I felt like transforming the selector without warning is not a good plan.
The other option here is to only bring in selectors that begin with the parent: so no combo selectors.
Updates:
critical
tocritical-selector
scope
option forcritical-selector
to move a selector and all its children to critical CSScritical-dest
property for arbitrary alternate destination filesouptputPath
option for output directorypreserve
option for removing/saving rules flagged as criticalminify
option for minifying output withcssnano
Note/Question: The
scope
value has the effect of dragging in related, but unnecessary group selectors. For example, if you usecritical-selector: scope
on.news-item
, it may drag in a selector like.container:after, .news-item:after, .third-selector:after, ... {...}
. I considered pulling out only the relevant selector, but wasn't sure if that might have unintended consequences or simply be a Bad Idea™. Currently it brings in the entire selector; I felt like transforming the selector without warning is not a good plan.The other option here is to only bring in selectors that begin with the parent: so no combo selectors.