An example of using grunt-uncss on a Sass project
JavaScript CSS
Switch branches/tags
Nothing to show
Failed to load latest commit information.
app visual fixes Feb 9, 2014
test adding initial version Feb 8, 2014
.bowerrc adding initial version Feb 8, 2014
.gitattributes adding initial version Feb 8, 2014
.gitignore adding initial version Feb 8, 2014
LICENSE Initial commit Feb 8, 2014 adding setup/usage/notes Feb 9, 2014


An example of using grunt-uncss on a simple multi-page Sass project.


Clone the repository and install necessary dependencies:

$ git clone
$ cd grunt-uncss-sass-example
$ npm install && bower install

Run one of the available build tasks.

$ grunt

will build a version of the project without unused CSS removed. By default the stylesheet this produces is ~95KB.

$ grunt build-uncss

will build a version with unused CSS removed. The stylesheet produced by this build is ~13KB.


The initial app was generated using Yeoman's generator-webapp and includes all the necessary tasks for Sass/Compass compilation, watching and optimization.

The most important point worth noting is that grunt-uncss is run at the very end of your build process here, ensuring all preprocessor tasks have had their chance to complete. This works fine for me.

You can run uncss earlier on in the build if you want, but will need to take care of pointing your usemin blocks to the correct final destination of your CSS files, as they will otherwise point to where it expects your Sass files to go. Something like grunt-processhtml can be used here if required.


(C) Addy Osmani 2014, released under an MIT license