所以,我有一个布局为
的项目src
--library
----a.coffee
----b.coffee
----c.coffee
--demo
----main.coffee
我目前已经设置了grunt来将src / library中的coffeescript编译为中间/库,将结果连接到intermediate / library.js并放入dist
这很好用,但是现在我还要看src / demo并做同样的事情,我该怎么做呢?
我的咕噜声文件是:
module.exports = (grunt) ->
grunt.loadNpmTasks("grunt-contrib-coffee")
grunt.loadNpmTasks("grunt-contrib-watch")
grunt.loadNpmTasks("grunt-contrib-concat")
grunt.initConfig
watch:
coffee:
files: "src/library/**/*.coffee"
tasks: ["coffee:compile", "concat"]
coffee:
compile:
expand: true,
flatten: true,
cwd: "src/library",
src: ["**/*.coffee"],
dest: "intermediate/library/",
ext: ".js"
concat:
options:
separator: ";"
dist:
src: ["intermediate/library.js", "intermediate/library/**/*.js"]
dest: "dist/library.js"
grunt.registerTask "default", ["watch"]
答案 0 :(得分:0)
好的,我已经解决了。
watch: # specific name for the task that I want to run
anyName: # name of my specific configuration of the task
所以我可以做到
concat:
options:
separator: ";"
library:
src: ["intermediate/library.js", "intermediate/library/**/*.js"]
dest: "dist/library.js"
demo:
src: ["intermediate/demo.js", "intermediate/demo/**/*.js"]
dest: "dist/demo.js"
例如