我开始探索 Grunt。看了几个网站,我看到了例子。好吧,我创建了 package.json 和 Gruntfile.js:
package.json http://pastebin.com/Kkt8fuXJ
Gruntfile.j http://pastebin.com/LnSmTzXZ
我的项目文件夹的组织是:
root (index.html)
-src (where is package.json and Gruntfile.js)
-lib
--css
---min
--js
--img
当我发出命令 grunt 总是会发生这个错误:
Loading "Gruntfile.js" tasks...ERROR
>> Error: Unable to parse "package.json" file (Unexpected token }).
Warning: Task "default" not found. Use --force to continue.
Aborted due to warnings.
如果我删除 pkg: grunt.file.readJSON('package.json'),:
grunt.loadNpmTasks('grunt-contrib-imagemin');
^^^^^
Loading "Gruntfile.js" tasks...ERROR
>> SyntaxError: Unexpected identifier
Warning: Task "default" not found. Use --force to continue.
Aborted due to warnings.
怎么了?
谢谢