Reputation: 1544
How can I compile one .scss file to a .css file in two different locations with one watch task?
I want task 'default' to do both tasks 'styles' and 'pub', not just 'styles'.
var gulp = require('gulp');
var sass = require('gulp-sass');
gulp.task('styles', function() {
gulp.src('web/sass/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('web/css/'));
});
gulp.task('pub', function() {
gulp.src('web/sass/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('../../../../../pub/static/frontend/Training/default/en_US/css/'));
});
gulp.task('default', function() {
gulp.watch('web/sass/**/*.scss',['styles']);
});
Upvotes: 0
Views: 255
Reputation: 424
To add more tasks to a master task, simply add them like you would an array. So your default task would be:
gulp.task('default', function() {
gulp.watch('web/sass/**/*.scss',['styles','pub']);
});
Upvotes: 2