Finds the Above the Fold CSS for your page, and outputs it into a file
Install the module with: npm install criticalcss
var criticalcss = require('criticalcss');
criticalcss.findCritical("path/to/file/or/url", options (not required), function(err, output){
if( err ){
throw new Error( err );
} else {
fs.writeFileSync( "filename, output );
}
});
.findCritical
Takes url or path to file, an options hash, and a callback function
- width: 1200;
- height: 900;
- filename: "all.css";
Check out the tests!
In lieu of a formal styleguide, 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.1.0 - Hey, released this thing
Copyright (c) 2014 Scott Jehl/Jeffrey Lembeck/Filament Group
Licensed under the MIT license.