How can I use CSS-Purge to clean up my code, without losing my comments and all formatting in my css file?
Thanks :)
How can I use CSS-Purge to clean up my code, without losing my comments and all formatting in my css file?
Thanks :)
you can use the config options to turn on/off features.
In your scenario, you could set the following options to false:
or just set trim
to false for all of them to be disabled.
If you're doing the global or local usage, you can pass in a config file with the -f command line option:
css-purge -f myconfig.json -i mycss.css -o mynewcss.css
If you're using it as a library, then you can just pass it in as a parameter:
var cssPurge = require('css-purge');
//purging a CSS string with options
var css = "p { color: blue; color: blue; } ";
cssPurge.purgeCSS(css, {
trim : false,
shorten : true
}, function(error, result){
if (error)
console.log(error)
else
console.log('Output CSS: ', result);
});
Check out all the options at: http://rbtech.github.io/css-purge
There's an example config file structure in the Getting Started > Config section.