My bootstrap stylesheet size is around 120kb.
But I\'m only using 25% of that stylesheet code.
I don\'t want that span* class. I tried it by customizing it in
After an hour of struggling with grunt, I decided to try uncss by itself, and it was much simpler. If you only have a few pages to do, or don't mind doing it manually, I'd recommend doing that.
The uncss page has full instructions, but to summarize:
npm install -g uncss
var files = ['my', 'array', 'of', 'HTML', 'files']
) stylesheets : ['lib/bootstrap/dist/css/bootstrap.css', 'src/public/css/main.css']
). Likewise change the value of "csspath" if you need to.node uncss.js
(or whatever you called your uncss file).
It spits out the optimized CSS straight to the command line, so save it to a file with something like node uncss.js > mynewcss.css
.There are a bunch of options to tailor the behavior. I ignored all of them and it worked fine, but they're there if you want them. The page I tested it on went from 138kb to 9kb.