我在Windows的cmd行中运行gulp。当我编辑SCSS文件时,除非激活cmd窗口,否则不会启动gulp watch。这是正常行为吗?
这是我的gulpfile:
// grab our packages
var gulp = require('gulp'),
sass = require('gulp-ruby-sass')
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
rename = require('gulp-rename');;
// define the default task and add the watch task to it
gulp.task('default', ['watch']);
gulp.task('build-css', function() {
return sass('src/scss/**/*.scss', {
style: 'expanded'
})
.pipe(gulp.dest('public/css/'))
.pipe(rename({suffix: '.min'}))
.pipe(minifycss())
.pipe(gulp.dest('public/css'));
});
// configure which files to watch and what tasks to use on file changes
gulp.task('watch', function() {
gulp.watch('src/scss/**/*.scss', ['build-css']);
});