Critical CSS
Styles that are needed for the first, above-the-fold
view are inlined in the
The full stylesheet is then loading asynchronously,
not blocking the rest of the page
How to find critical CSS
• critical by Addy Osmani
• grunt-criticalcss by Filament Group
Slide 56
Slide 56 text
What about the
full stylesheet?
Slide 57
Slide 57 text
https://github.com/filamentgroup/loadCSS
loadCSS
Slide 58
Slide 58 text
...
// include loadCSS here...
function loadCSS( href, before, media ){ ... }
// load a file
loadCSS( "path/to/mystylesheet.css" );
...
Slide 59
Slide 59 text
But, but, inline styles
aren’t cacheable…
Slide 60
Slide 60 text
<!-- Critical styles go here -->
// include loadCSS here...
function loadCSS( href, before, media ){ ... }
// load a file
loadCSS( "path/to/mystylesheet.css" );
// Set cookie here
Slide 61
Slide 61 text
• Use a CSS methodology or standard
• Concatenate
• Minify
• Inline critical CSS
• Load full stylesheet asynchronously
Summary