|
@@ -6,24 +6,75 @@ module.exports = function(grunt) {
|
|
|
|
|
|
|
|
|
|
concat: {//任务名称
|
|
concat: {//任务名称
|
|
- js: {
|
|
|
|
|
|
+ curing: {
|
|
src: ['global/js/cloud/curing.js','global/js/cloud/curingFN.js','global/js/cloud/curingHtml.js'],
|
|
src: ['global/js/cloud/curing.js','global/js/cloud/curingFN.js','global/js/cloud/curingHtml.js'],
|
|
- dest: 'global/js/cloud/curing.min.js'
|
|
|
|
|
|
+ dest: 'global/js/cloud/curing.concat.js'
|
|
},
|
|
},
|
|
-// css: {
|
|
|
|
-// src: ['css/*.css'],
|
|
|
|
-// dest: 'build/all.css'
|
|
|
|
-// }
|
|
|
|
- }
|
|
|
|
|
|
+ build:{
|
|
|
|
+ src: ['global/js/cloud/build.js','global/js/cloud/buildFN.js','global/js/cloud/buildHtml.js'],
|
|
|
|
+ dest: 'global/js/cloud/build.concat.js'
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
|
|
|
|
|
|
|
|
+ pkg: grunt.file.readJSON('package.json'),
|
|
|
|
+ uglify: {
|
|
|
|
+ options: {
|
|
|
|
+ banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'//添加banner
|
|
|
|
+ },
|
|
|
|
+ curing: {//任务一:压缩a.js,不混淆变量名,保留注释,添加banner和footer
|
|
|
|
+ options: {
|
|
|
|
+ mangle: true, //false 不混淆变量名
|
|
|
|
+ preserveComments: 'false', //不删除注释,还可以为 false(删除全部注释),some(保留@preserve @license @cc_on等注释)
|
|
|
|
+ footer:'\n/*! <%= pkg.name %> 最后修改于: <%= grunt.template.today("yyyy-mm-dd") %> */'//添加footer
|
|
|
|
+ },
|
|
|
|
+ files: {
|
|
|
|
+ 'global/js/cloud/curing.min.js': ['global/js/cloud/curing.concat.js']
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ build: {
|
|
|
|
+ options: {
|
|
|
|
+ mangle: true,
|
|
|
|
+ preserveComments: 'false',
|
|
|
|
+ footer:'\n/*! <%= pkg.name %> 最后修改于: <%= grunt.template.today("yyyy-mm-dd") %> */'
|
|
|
|
+ },
|
|
|
|
+ files: {
|
|
|
|
+ 'global/js/cloud/build.min.js': ['global/js/cloud/build.concat.js']
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// build:{//任务二:压缩b.js,输出压缩信息
|
|
|
|
+// options: {
|
|
|
|
+// report: "min"//输出压缩率,可选的值有 false(不输出信息),gzip
|
|
|
|
+// },
|
|
|
|
+// files: {
|
|
|
|
+// 'output/js/b.min.js': ['js/main/b.js']
|
|
|
|
+// }
|
|
|
|
+// },
|
|
|
|
+// buildall: {//任务三:按原文件结构压缩js文件夹内所有JS文件
|
|
|
|
+// files: [{
|
|
|
|
+// expand:true,
|
|
|
|
+// cwd:'js',//js目录下
|
|
|
|
+// src:'**/*.js',//所有js文件
|
|
|
|
+// dest: 'output/js'//输出到此目录下
|
|
|
|
+// }]
|
|
|
|
+// },
|
|
|
|
+// release: {//任务四:合并压缩a.js和b.js
|
|
|
|
+// files: {
|
|
|
|
+// 'output/js/index.min.js': ['js/a.js', 'js/main/b.js']
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
|
|
+ grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
|
|
|
|
//注册grunt默认任务
|
|
//注册grunt默认任务
|
|
- grunt.registerTask('default', []);
|
|
|
|
|
|
+ grunt.registerTask('default', ['concat','uglify']);
|
|
|
|
|
|
};
|
|
};
|