我是新來的grunt,並試圖將它安裝在一個簡單的項目上。它的工作,但是當我嘗試「ugilfy」我的文件來看,我不斷收到此錯誤:GruntJS:不能調用未定義的方法過濾器
cannot call method 'filter' of undefined'
這是我咕嚕文件(Gruntfile.js),保存在我的項目的根目錄:
module.exports = function(grunt)
{
grunt.initConfig({
uglify:
{
options:
{
mangle: true,
compress:true,
sourceMap: "dist/app.map",
banner: "/* 2014 */"
},
//set of files where the plugin works on, (files which we can affect with our plugins like uglify)
// culd be dev or production
target:
{
//folder name equal to the JS object!!!
js: "js/app.js",
dest: "dist/app.min.js"
}
}
});
//load plug-ins
grunt.loadNpmTasks('grunt-contrib-uglify');
};
我嚴重不知道爲什麼它不工作。我試圖搜索谷歌,但我找不到任何答案。
聽起來像它不喜歡你的一些Javascript。 'grunt --force'對你有幫助嗎? – Ben 2014-10-07 13:29:32
還沒有工作:(我得到了相同的警告,但沒有創建文件:/ – Marciano 2014-10-07 14:45:33
好吧,這是遠射,你需要檢查你的Javascript,像jslint.com這樣的工具將有所幫助 – Ben 2014-10-07 19:40:07