目前我已经设置了一个cake
任务来观察和编译 CoffeeScript、Jade、Stylus,比如:
task "startdev", "Starts server with nodemon and watch files for changes", ->
# start nodemon server
nodemon = spawn procExec("nodemon"), ["server.coffee"]
processOutput nodemon
# watch and compile CoffeeScript
coffee = spawn procExec("coffee"), ["-o", "public/js/app", "-cw", "client/coffee"]
processOutput coffee
# watch and compile Stylus
stylus = spawn procExec("stylus"), ["client/stylus/styles.styl", "-I", "public/css/","-l", "-w", "-u", "./node_modules/nib", "-o", "public/css/app"]
processOutput stylus
# watch and compile jade
jade = spawn procExec("jade"), ["client/jade/index.jade", "--out", "public"]
processOutput jade
现在,我想监视文件夹中的文件更改并将其复制到另一个文件夹(又名同步文件夹,将文件从复制src
到public
)。我该怎么做?我认为如果解决方案不是特定于 Node/JS 的,我认为这很好,只要我不必下载一大堆和大量的设置来使其工作。
经过一番研究,也许我应该使用类似的构建jake
?但是我如何使用它来同步 2 个文件夹