Last active
January 1, 2016 03:09
-
-
Save jinlong/8083660 to your computer and use it in GitHub Desktop.
Grunt config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
// 非常基本的默认任务 | |
grunt.registerTask('default', 'Log some stuff.', function() { | |
grunt.log.write('Logging some stuff...').ok(); | |
}); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/<%= pkg.name %>.js', | |
dest: 'build/<%= pkg.name %>.min.js' | |
} | |
} | |
}); | |
// 加载插件,提供 "uglify" 任务。 | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
// 默认任务。 | |
grunt.registerTask('default', ['uglify']); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "my-project-name", | |
"version": "0.1.0", | |
"devDependencies": { | |
"grunt": "~0.4.2", | |
"grunt-contrib-jshint": "~0.6.3", | |
"grunt-contrib-nodeunit": "~0.2.0", | |
"grunt-contrib-uglify": "~0.2.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment