gulp - Wait prev task before starting next tasks -
i'd create watcher watch files , compile them.
i have 2 tasks :
- mincss
- compile
i'd execute compile
in first , wait end before executing mincss
... seem's not working.
my code :
var scsstocompile = [ './public/sass/themes/adms/adms.scss', './public/sass/themes/arti/arti.scss', './public/sass/themes/avantage/avantage.scss', './public/sass/themes/basique/basique.scss', './public/sass/themes/mairie/mairie.scss', './public/sass/themes/vehik/vehik.scss', './public/sass/themes/concept/concept.scss', './public/sass/themes/news/news.scss', './public/sass/components/*.scss', './public/sass/_functions.scss', './public/sass/_settings.scss', './public/sass/app.scss', './public/sass/bottom.scss' ]; gulp.task('compile', function(){ return gulp.src(scsstocompile) .pipe(sassglob()) .pipe(sass({includepaths: ['./public/sass']}).on('error', function(err) { cb(err); })) .pipe(gulp.dest('./public/stylesheets')); }); gulp.task('mincss', function() { return gulp.src('public/stylesheets/themes/**/*.css') .pipe(minifycss()) .pipe(rename({suffix: '.min'})) .pipe(gulp.dest('public/build/css')); }); // watcher gulp.task('watch', function(){ gulp.watch(scsstocompile, ['compile', 'mincss']); });
results :
[15:21:36] using gulpfile c:\xampp\htdocs\gulpfile.js [15:21:36] starting 'watch'... [15:21:37] finished 'watch' after 153 ms [15:21:41] starting 'compile'... [15:21:46] starting 'mincss'... [15:21:46] finished 'mincss' after 6.42 μs [15:21:48] finished 'compile' after 6.44 s
Comments
Post a Comment