2014-09-10 48 views
0

我是新來的grunt,並且遇到乾淨的:dist任務,因爲grunt-contrib-clean問題。這是我的任務代碼。Yeoman/Grunt clean:dist任務屬性undefined

clean: { 
    dist: { 
     files: [{ 
      dot: true, 
      src: [ 
       '.tmp', 
       '<%= yeoman.dist %>/*', 
       '!<%= yeoman.dist %>/.git*', 
       '!<%= yeoman.dist %>/Procfile', 
       '!<%= yeoman.dist %>/package.json', 
       '!<%= yeoman.dist %>/web.js', 
       '!<%= yeoman.dist %>/node_modules' 
      ] 
     }] 
    }, 
    server: '.tmp' 
}, 

當我運行繁重的建設,我得到以下警告「時發生錯誤,處理模板(無法讀取屬性未定義‘DIST’)。使用--force繼續。」我認爲它一定是一個語法錯誤或者一個插件的錯誤,但我不知道足以讓它知道。

回答

0

出於某種原因,從<%= yeoman.dist%>更改爲<%= config.dist%>解決了我的問題。不知道什麼時候使用yeoman.dist語法是合適的,但無論如何我解決了我自己的問題。所以解決方案是...

clean: { 
    dist: { 
    files: [{ 
     dot: true, 
     src: [ 
     '.tmp', 
     '<%= config.dist %>/*', 
     '!<%= config.dist %>/.git*', 
     '!<%= config.dist %>/Procfile', 
     '!<%= config.dist %>/package.json', 
     '!<%= config.dist %>/web.js', 
     '!<%= config.dist %>/node_modules' 
     ] 
    }] 
    }, 
    server: '.tmp' 
},