代码如下 | 复制代码 |
{
“name”: “grunt”,
“version”: “0.1.0″,
“devDependencies”: {
“grunt”: “~0.4.0″,
“grunt-contrib-jshint”: “~0.1.1″,
“grunt-contrib-nodeunit”: “~0.1.2″, “grunt-contrib-watch”: “~0.2.0″, “grunt-contrib-concat”: “~0.1.1″, “grunt-contrib-uglify”: “~0.1.0″, “grunt-contrib-cssmin”: “~0.9.0″, “difflet”: “~0.2.3″ }
}
|
代码如下 | 复制代码 |
module.exports = function(grunt){
grunt.initConfig({
pkg: grunt.file.readJSON(‘package.json’), uglify: { options: { banner: ‘/*! <%= pkg.name %> <%= grunt.template.today(“yyyy-mm-dd”) %> */n’ }, build: { src: ‘src/test.js’, dest: ‘build/test.min.js’ } } }); // 加载提供”uglify”任务的插件
grunt.loadNpmTasks(‘grunt-contrib-uglify’); // 默认任务
grunt.registerTask(‘default’, ['uglify']); } |