Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Stripping down your CSS

Primoz
February 18, 2015

Stripping down your CSS

CSS frameworks like Bootstrap can dramatically speed-up prototyping and frontend development. But at the same time, they introduce bloated CSS codebase at the very beginning. Luckily, we have automated tools which will help us solve these issues. This talk will be about UnCSS project - when to use it, how to use it and real-world examples.

Primoz

February 18, 2015
Tweet

More Decks by Primoz

Other Decks in Programming

Transcript

  1. “excessive unused styles are likely to cost more, performance wise,

    than any selectors you chose so look to tidy up there second.” Ben Frain http://benfrain.com/css-performance- revisited-selectors-bloat-expensive- styles/
  2. 1. The HTML files are loaded by PhantomJS and JavaScript

    is executed. 2. Used stylesheets are extracted from the resulting HTML. 3. The stylesheets are concatenated and the rules are parsed by css-parse. 4. document.querySelector filters out selectors that are not found in the HTML files. 5. The remaining rules are converted back to CSS.