2013-05-21 115 views
3

我試圖在外部JSON文件讀取和使用,在自定義任務閱讀:Gruntjs從外部JSON文件

initConfig

grunt.initConfig({ 
    env: grunt.file.readJSON("PATH"), 
    ... 
    .. 
    . 
}); 

// Registering a task 
grunt.registerTask('Namehere', 'DescriptionHere', function() { 
    // HOW DO I GET AT THE "env" 

    "<%= env.environment %>" // Doesnt work just gives me the string literal "<%= environmentVars.environment %>" 
}); 

回答