gulp编译sass 提示错误Task '' is not in your gulpfile

clipboard.png

提示错误

Task 'watch' is not in your gulpfile
Please check the documentation for proper gulpfile formatting

代码

var gulp = require('gulp');
// 引入依赖包
var sass = require('gulp-sass');
gulp.task('sass', function(){
    //sass()方法用于转换sass到css
  return gulp.src('../sass/mj.scss')
    .pipe(sass()) // Converts Sass to CSS with gulp-sass
    .pipe(gulp.dest('../css/'));
});
//Watching Sass files for changes
gulp.task('watch', function(){
  gulp.watch('app/scss/**/*.scss', ['sass']); 
  // Other watchers
});
gulp.task('default', ['sass','watch']);
阅读 3.7k
评论 更新于 2017-07-18
    撰写回答

    登录后参与交流、获取后续更新提醒