我正在尝试做两个任务,一个监视和构建任务.监视任务调用我的'coffee'任务,将我的.coffee文件编译成javascript.构建任务应该基本上做同样的事情,除了我想解析一个布尔到函数中,这样我就可以编译包括源映射的代码.
gulp = require 'gulp'
gutil = require 'gulp-util'
clean = require 'gulp-clean'
coffee = require 'gulp-coffee'
gulp.task 'clean', ->
gulp.src('./lib/*', read: false)
.pipe clean()
gulp.task 'coffee', (map) ->
gutil.log('sourceMap', map)
gulp.src('./src/*.coffee')
.pipe coffee({sourceMap: map}).on('error', gutil.log)
.pipe gulp.dest('./lib/')
# build app
gulp.task 'watch', ->
gulp.watch './src/*.coffee', ['coffee']
# build app
gulp.task 'build', ->
gulp.tasks.clean.fn()
gulp.tasks.coffee.fn(true)
# The default task (called when you run `gulp` from cli)
gulp.task 'default', ['clean', 'coffee', 'watch']
Run Code Online (Sandbox Code Playgroud)
有人为我的问题找到解决方案吗?我原则上做错了吗?提前致谢.