我有两个文件:启动http服务器的app.js和由browserify编译并在html中使用的main.js
所以我有一个配置了forever、browserify和watch的Grunt。我希望在 app.js 机会上,必须重新启动 http(通过永远:重新启动),并且当 main.js 更改时,必须对构建进行浏览器化(通过 browserify)
所以,当我运行 grunt 时,永远说:start 不存在,有什么帮助吗?
$ grunt
Warning: Task "forever:server1:start" not found. Use --force to continue.
这是我的 gruntfile:
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
browserify: {
dist: {
files: {
'examples/public/js/module.js': ['examples/main.js']
}
}
},
forever: {
server1: {
options: {
index: 'examples/app.js',
logDir: 'examples/logs'
}
}
},
watch: {
app: {
files: ['examples/*.js', 'examples/templates/*' ],
tasks: ['forever:server1:start']
},
web: {
files: ['examples/*.js', 'examples/templates/*' ],
tasks: ['browserify']
},
}
});
//grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-watch');
// Default task(s).
grunt.registerTask('default', ['browserify', 'forever:server1:start']);
grunt.registerTask('restart', ['browserify', 'forever:server1:restart']);
};