Skip to content

Instantly share code, notes, and snippets.

@tterb
Created December 20, 2019 07:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tterb/881ad455a2474009d7e256f0b1c31e63 to your computer and use it in GitHub Desktop.
Save tterb/881ad455a2474009d7e256f0b1c31e63 to your computer and use it in GitHub Desktop.
Gulpfile critical
// Create and process critical CSS file to be included in head
gulp.task('build:styles:critical', function() {
return sass(paths.sassFiles + '/critical.scss', {
style: 'compressed',
trace: true,
loadPath: [paths.sassFiles]
}).pipe(postcss([ autoprefixer({ browsers: ['last 2 versions'] }), cssnano()]))
.pipe(gulp.dest('_includes'))
.on('error', gutil.log);
});
// Build all styles
gulp.task('build:styles', ['build:styles:main', 'build:styles:critical']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment