Answer the question
In order to leave comments, you need to log in
How to run gulp task from code?
Hello, I have a gulp build, it has a task to build less of the main file, it looks like this
gulp.task('less1', function() {
return gulp.src(src.less)
.pipe(plumber())
.pipe(less())
.pipe(min())
.pipe(pref({
browsers: ['last 8 versions'],
cascade: false
}))
.pipe(gulp.dest('app/css'))
.pipe(reload({stream:true}));
})
gulp.task('media', function() {
return gulp.src(src.media)
.pipe(plumber())
.pipe(less())
.pipe(min())
.pipe(pref({
browsers: ['last 8 versions'],
cascade: false
}))
.pipe(reload({stream:true}));
})
gulp.task('watcher', function() {
gulp.watch(src.less, ['less1']);
gulp.watch(src.media, ['media']);
})
gulp.task('default', ['watcher', 'sync'])
Answer the question
In order to leave comments, you need to log in
I also came up with the idea to write rules for media queries in separate files, it looks like this
gulp.watch(src.less, ['less1', 'media']);
gulp.watch(src.media, ['media']);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question