Grunt wrapper for criticalcss
This plugin requires Grunt
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-criticalcss --save-dev
The "criticalcss" task
In your project's Gruntfile, add a section named
criticalcss to the data object passed into
REQUIRED: A string for the URL of the site you'd like to run this script against
A string value for the entire path of a css file that you have hosted locally.
An integer value of the width of the screen in pixels
An integer value of the height of the screen in pixels
A string value that is the file path for wherever you would like the css to be output to
An array of selectors that you want to guarantee will make it from the CSS file into your CriticalCSS output.
Sets the maxBuffer for child_process.execFile in Node. Necessary for potential memory issues.
If set to
If you include
@font-face declarations in your
all.css file and set this flag to
true in your options, criticalcss will include all the
@font-face declarations that are required to satisfy
font-family declarations in the criticalcss output.
In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
- v0.5.0 - Add support for ignoreConsole
- v0.4.0 - Add support for buffer size, so you don't exceed the buffer
- v0.3.0 - Moved to using a local filename instead of a pattern-match
- v0.2.0 - Added
- v0.1.0 - Original release