3 ms·
Personally, I use the PurifyCSS[1] and PurgeCSS[2] Grunt/Gulp/Webpack modules for this task. https://github.com/purifycss/purifycss https://github.com/purifyc
by tofof 8y ago
Personally, I use
the PurifyCSS[1] and PurgeCSS[2] Grunt/Gulp/Webpack modules for this task.
https://github.com/purifycss/purifycss https://github.com/purifycss/purifycss
https://github.com/FullHuman/purgecss https://github.com/FullHuman/purgecss
The Purge documentation claims that a third tool, UnCSS[3], may be even more accurate.
https://github.com/uncss https://github.com/uncss
- Mtinie 8y ago@tofof: Do you have a workflow which uses both of them the tools in series, or do you pick one or the other depending upon what you're doing? PurifyCSS and PurgeCSS, at least from a cursory review, appear to have similar functionality.
- tofof 8y agoYou're correct that they're very similar; PurgeCSS even describes itself as an improvement to PurifyCSS. (Purge tries to actually parse for matches, whereas Purify just looks for the presence of words -- so if you have a .arrow CSS rule in your framework, and you happen to use the word 'arrow' in body text somewhere, Purify will needlessly include that style in its output). But yes, I actually use both tools in series. I get a small reduction from Purifying the output of Purge (I haven't actually bothered to diff it to see where), and Purify stitches the files together and minifies in addition to pruning.
- gitgud 8y agoIs there a tool which can intelligently reactor the rules in a CSS file? So like combine all the same background colour references etc. I suppose this would require HTML changes too, but am interested to see if this has been done.