我正在使用此“初学者指南”指南:https://css-tricks.com/gulp-for-beginners/
这是我的gulpfile.js:
var gulp = require('gulp');
// Requires the gulp-sass plugin
var sass = require('gulp-sass');
gulp.task('sass', function() {
return gulp.src('sass/**/*.sass') // Gets all files ending with .sass in /sass
.pipe(sass())
.pipe(gulp.dest('css'))
});
gulp.task('watch', ['sass'], function (){
gulp.watch('app/scss/**/*.scss', ['sass']);
});
我只想让Gulp正常工作,但是我不确定我的本地环境设置是否不正确,我不知道该怎么办。
要么我的gulpfile编写不正确,要么我担心macbook出现问题,因为我一直在努力使gulp,咕unt声或其他cli东西无法正常工作。
我的终端窗口:
$ gulp watch
assert.js:350
throw err;
^
AssertionError [ERR_ASSERTION]: Task function must be specified
at Gulp.set [as _setTask] (/Users/myName/Sites/projectName/wp-content/themes/project/node_modules/undertaker/lib/set-task.js:10:3)
at Gulp.task (/Users/myName/Sites/projectName/wp-content/themes/project/node_modules/undertaker/lib/task.js:13:8)
at Object.<anonymous> (/Users/myName/Sites/projectName/wp-content/themes/project/gulpfile.js:13:6)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)