Answer the question
In order to leave comments, you need to log in
How to combine home page styles into one css file?
It is necessary to collect styles for the visible area that the user sees at the entrance. Roughly speaking the first 1000px.
I heard that gulp can do it. But I don't know how to do it. Maybe someone in the know?
Answer the question
In order to leave comments, you need to log in
fourword.fourkitchens.com/article/use-gulp-automat...
var critical = require('critical');
gulp.task('critical', function (cb) {
critical.generate({
base: '_site/',
src: 'index.html',
css: ['css/all.min.css'],
dimensions: [{
width: 320,
height: 480
},{
width: 768,
height: 1024
},{
width: 1280,
height: 960
}],
dest: '../_includes/critical.css',
minify: true,
extract: false,
ignore: ['font-face']
});
});
var gulp = require('gulp');
var uncss = require('gulp-uncss');
gulp.task('default', function() {
gulp.src('site.css')
.pipe(uncss({
html: ['index.html', 'about.html']
}))
.pipe(gulp.dest('./out'));
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question