2015-05-24 82 views

回答

1

安裝咕嚕

解決方案>右鍵單擊>添加>新項目> NPM配置文件> 粘貼下面的代碼>保存>耐心等待,直到它安裝

{ 
    "version": "1.0.0", 
    "name": "asp.net", 
    "private": true, 
    "devDependencies": { 
    "grunt": "1.0.1", 
    "grunt-contrib-uglify": "1.0.1", 
    "grunt-contrib-watch": "1.0.0", 
    "bower": "1.7.9" 
    } 
} 


配置Grunt

解決方案>右鍵單擊>添加>新項目>咕嚕配置文件> 粘貼下面的代碼>保存

module.exports = function (grunt) { 

    //load whatever you need here 
    grunt.loadNpmTasks('grunt-contrib-uglify'); 
    grunt.loadNpmTasks('grunt-contrib-watch'); 

    //Task configuration is specified in your Gruntfile via this method 
    grunt.initConfig({ 
     uglify: { 
      my_target: { 
       files: { 
        'wwwroot/app.js': ['scripts/app.js', 'scripts/**/*,'] 
       } 
      } 
     }, 
     watch: { 
      script:{ 
       files: ['scripts/**/*,'], 
       tasks: ['uglify'] 
      } 

     } 
    }); 
    //register your tasks here(taskName,taskList) 
    grunt.task.registerTask('task-minified', ['uglify', 'watch']) 

}; 


來測試咕嚕

查看>其他視窗> Task Runner Explorer

enter image description here