Critical extracts & inlines critical-path (above-the-fold) CSS from HTML
$ npm install --save critical
Build pluginsDemo projectsUsage
Full blown example with available options:
Generate and minify critical-path CSS:
Generate, minify and inline critical-path CSS:
Generate and return output via callback:
Generate and return output via promise:
When your site is adaptive and you want to deliver critical CSS for multiple screen resolutions this is a useful option. note: (your final output will be minified as to eliminate duplicate rule inclusion)
This is a usefull option when you e.g. want to defer loading of webfonts or background images.
... read the whole story at github.com.