我正在尝试通过 grunt/browserify 构建我的 JS 捆绑包。我还使用 grunt 进行 scss 编译。为此,我使用 grunt-watch 在更改时触发 scss 编译。
我希望 JS-browserify 具有相同的行为。grunt-browserify 带有“watch”选项,这个选项非常好。
我唯一的问题是:我想在“重新浏览”后得到通知。对于 SCSS,我使用 grunt-notify。但是在browserify-watch之后我没有找到任何方法来触发grunt任务。
我的 gruntfile 摘录:
var gruntOptions = {
notify: {
browserify_node_modules: {
options: {
title: "Browserify",
message: "node_modules build"
}
}
},
browserify: {
node_modules: {
src: ["node_modules.js"],
dest: "trunk/js/lib/node_modules.js",
options: {
watch: true,
}
}
}
};
最佳情况:
options: {
watch: true,
finishTask: "notify:browserify_node_modules"
}
谢谢!