Skip to content

Instantly share code, notes, and snippets.

@jinlong
Last active January 1, 2016 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jinlong/8083660 to your computer and use it in GitHub Desktop.
Save jinlong/8083660 to your computer and use it in GitHub Desktop.
Grunt config
module.exports = function(grunt) {
// 非常基本的默认任务
grunt.registerTask('default', 'Log some stuff.', function() {
grunt.log.write('Logging some stuff...').ok();
});
};
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']);
};
{
"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