Created
July 6, 2017 06:27
-
-
Save stephenasamoah/ffb8ca4f3a304a309dd682d079423c61 to your computer and use it in GitHub Desktop.
Gulp critical css snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
criticalOpts: { | |
base: paths.dest, | |
css: [paths.dest + 'css/styles.css'], // multiple stylesheets concatenated | |
minify: true, | |
} | |
// htmldir.in = '_site/**/*.html'; | |
// gulp-concat combines all files from multiple pages into one | |
// nano purges redundant code and minifies. | |
gulp.task('critical', function () { | |
return gulp.src(paths.htmldir.in) | |
.pipe(critical(paths.cssdir.criticalOpts)) | |
.pipe(concat('critical.css')) | |
.pipe(nano()) | |
.pipe(gulp.dest(paths.includeDir)) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment