【发布时间】:2015-04-05 06:55:36
【问题描述】:
这是我的 gruntfile.js
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.initConfig({
uglify:{
my_target: {
files:{
'_/js/script.js': ['_/components/js/*.js']
}//files
}//myTarget
},//uglify
compass: {
dev:{
options: {
config: 'config.rb',
}//options
}//dev
},//compass
watch: {
options: {livereload: true},
scripts: {
files: ['_/components/js/*.js'],
tasks: ['uglify']
},//scripts
html: {
files: ['*.html']
},//html
sass: {
files: ['_/components/sass/*.scss']
tasks: ['compass:dev']
},//sass
}//watch
})//initConfig
grunt.registerTask('default','watch');
}//exports
在命令提示符中运行 grunt 会出现错误: 正在加载“gruntfile.js”任务...错误>> SyntaxError:意外标识符警告:找不到任务“默认”。使用 --force 继续。
当我注释掉 SASS 块(在 gruntfile.js 中)......然后 grunt 说:正在运行“监视”任务等待......一切正常!
有谁知道可能是什么问题?
【问题讨论】:
标签: gruntjs grunt-contrib-watch