Penthouse - gulp
var penthouse = require('penthouse');
var fs = require('fs');
var cleanCSS = require('clean-css');
gulp.task('penthouse', ['styles'], function () {
penthouse({
url: '%WEBPAGE_URL%',
css: '%LOCAL_CSS_FILE%',
width: 480,
height: 800
}, function (err, critical) {
if (err) {
throw err;
}
var clean = new cleanCSS().minify(critical);
fs.writeFile('%CRP_HTML_FILE_INCLUDED_IN_HEAD%', '<style>' + clean.styles + '</style>');
});
});