module.exports = function(grunt) {

    //初始化配置grunt任务
    grunt.initConfig({

    	
    
    	concat: {//任务名称
            curing: {
                src: ['global/js/cloud/curing.js','global/js/cloud/curingFN.js','global/js/cloud/curingHtml.js',
                		'global/js/cloud/page.js','global/js/tools.js','global/js/columnShow/columnShow.js',
                		'global/js/contacts/buildHtml.js'],
                dest: 'global/js/cloud/curing.concat.js'
            },
            build:{
                src: ['global/js/cloud/build.js','global/js/cloud/buildFN.js','global/js/cloud/buildHtml.js',
            		'global/js/cloud/page.js','global/js/tools.js','global/js/columnShow/columnShow.js',
            		'global/js/contacts/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']
//                }
//            }
        },
        
        jshint:{
        	options:{
        		jshintrc:'.jshintrc'
        	},
        	build:['global/js/cloud/*.min.js']
        },
        
//        watch: {
//        	  scripts: {
//        	    files: ['**/*.js'],
//        	    tasks: ['concat','uglify','jshint'],
//        	    options: {
//        	      spawn: false,
//        	    },
//        	  },
//        },

        
        
        
    	
    });


    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');

    //注册grunt默认任务
    grunt.registerTask('default', ['concat','uglify']);
    //grunt.registerTask('watch', ['concat','uglify','jshint','watch']);

};