module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), //concat: { // options: { // separator: ';', // stripBanners: true // }, // dist: { // src: [ // ], // dest: "" // } //}, copy: { all: { expand: true, cwd: 'exts-src', src: [ '**/*.jpg', '**/*.gif', '**/*.png', '**/*.eot', '**/*.svg', '**/*.ttf', '**/*.woff', '**/*.woff2', '**/*.swf' ], dest: 'exts' } }, uglify: { options: { stripBanners: true }, build_exts:{ options: { mangle: false //混淆变量名 }, files: [ { expand:true, cwd:'exts-src',//modules-src 目录下 src:'**/*.js',//所有js文件 dest: 'exts'//输出到此目录下 } ] } }, cssmin: { options: { keepSpecialComments: 0, }, compress: { files: [ { expand: true, cwd: 'exts-src', src: ['**/*.css'], dest: 'exts' } ] } } }); grunt.loadNpmTasks('grunt-contrib-concat');//合并JS文件 grunt.loadNpmTasks('grunt-contrib-uglify');//js 压缩 grunt.loadNpmTasks('grunt-contrib-cssmin');//css 压缩 grunt.loadNpmTasks('grunt-contrib-jshint');//js 语法检查 grunt.loadNpmTasks('grunt-contrib-csslint');//css 语法检查 grunt.loadNpmTasks('grunt-contrib-copy');//复制文件 grunt.registerTask('default', [ 'copy', 'uglify:build_exts', 'cssmin' ] ); }