Gruntfile.js:
grunt.initConfig({
watch: {
compass: {
files: [
'app/styles/**/*.{scss,sass}'
],
tasks: 'compass reload'
},
.....
grunt.registerTask('dev', 'watch');
当我跑的时候
grunt dev
我得到了错误
Warning: Task "watch" not found. Use --force to continue.
我使用的是grunt-cli v0.1.6和grunt v0.4.0,安装了grunt-contrib-watch。
发布于 2013-02-20 19:13:11
井。
npm install grunt-contrib --save-dev
并在grunt.js的最后一行之前添加以下行:
grunt.loadNpmTasks('grunt-contrib');
另外,我还得安装Ruby。
发布于 2013-04-04 23:41:58
你不需要安装整个contrib包。有一个单独的手表
npm install grunt-contrib-watch --save-dev
最后:
grunt.loadNpmTasks('grunt-contrib-watch');
发布于 2014-12-09 22:15:03
实际上,如果没有安装这个插件,你不会出现启动grunt watch
的错误,只会出现一个无法加载watch
任务的错误。
https://stackoverflow.com/questions/14977771
复制相似问题