Answer the question
In order to leave comments, you need to log in
The reason for the slow execution of gulp tasks?
Greetings. Can you tell me why style and html tasks slow down (style - > 30 seconds)? Maybe I'm specifying something incorrectly or combining plugins incorrectly?
//=======================================================
// Style
//=======================================================
gulp.task('style', function () {
return gulp.src(path.src.style)
.pipe(plugins.newer(path.dist.css))
.pipe(plugins.plumber())
.pipe(plugins.sourcemaps.init())
.pipe(plugins.sass.sync())
.pipe(gulp.dest(path.src.css))
.pipe(plugins.csso())
.pipe(plugins.rename({suffix: '.min'}))
.pipe(plugins.sourcemaps.write())
.pipe(gulp.dest(path.dist.css))
.pipe(reload({stream: true}));
});
//=======================================================
// HTML
//=======================================================
gulp.task('html', function () {
return gulp.src(path.src.html)
.pipe(plugins.newer(path.dist.html))
.pipe(plugins.rigger())
.pipe(plugins.removeHtmlComments())
.pipe(plugins.replace(/^\s*\n/mg, ''))
.pipe(gulp.dest(path.dist.html))
.pipe(reload({stream: true}));
});
Answer the question
In order to leave comments, you need to log in
perhaps you should try sass() instead of sass.sync(), remove the intermediate gulp.dest (really, why?) and csso() for development time?
in general, turn off plugins one by one and see which one slows down the build
Among other things, I advise you to use the gulp-load-plugins plugin. It implements "lazy" loading of plugins, at the moment when they are needed. And spread the tasks across different files so that each task has a minimum require value. After all, when the interpreter sees require, it immediately reads the module and its submodules and loads it into execution.
If you have any questions, I'll tell you how to implement it all.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question