Run ucss with grunt.
Run ucss with grunt. Also adds the option to create "cleaned" versions of the css-files with the unused css selectors removed.
npm install grunt-ucss --save-dev
Once that's done, add this line to your project's Gruntfile:
If the plugin has been installed correctly, running
grunt --help at the command line should list the newly-installed plugin's task or tasks. In addition, the plugin should be listed in package.json as a
devDependency, which ensures that it will be installed whenever the
npm install command is run.
The task can do two things; Analyze html+css using ucss and print out any unused selectors in the grunt log and use that information to create new clean
In your project's Gruntfile, add a section named
ucss to the data object passed into
gruntinitConfigucss:target:options:whitelist: '.some-ok-selector'auth: nullpages:crawl: ''include: ''css: ''
An array of selectors that should be 'white listed' meaning will not be listed or cleaned away even though it isn't used.
Let's you specify authentication to use. See ucss auth documentation for more details
Specify a html-file to start crawling
Any extra pages not included in the crawl.
Specify what css files to analyze
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.
So, I started up this task and then abandoned it for a while... I've released this initial version just to get a version ppl can start using. I will add more test-cases and so on later on, and if you got an idea or feature to add just tell med :)