Gruntfilenew.js 7.15 KB
/**
 * 打包配置
 *
 */

'use strict';

module.exports = function( grunt ) {
	
	grunt.file.defaultEncoding = 'utf8';
	
	grunt.initConfig({
		pkg: grunt.file.readJSON( 'package.json' ),
		
		build: {
			//src: 'src/<%= pkg.name %>.js',
			//dest: 'dist/<%= pkg.name %>.min.js'
		},
		// css 合并
		css_combo: {
			//文件头部输出信息
            options: {
                banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
                //美化代码
                beautify: true
            },
			css: {
				files:{

					// 'css/dist/wap-app-download.css':['css/style/wap-app-download.css'],
					// 'css/dist/pnr1-2.css':['css/style/pnr1-2.css'],
					 // //首页
					// 'css/dist/index.css':['css/style/index.css'],
					
					 // //列表页
					// 'css/dist/list.css':['css/style/list.css'],
					// 'css/dist/shop-list.css':['css/style/shop-list.css'],
					// 'css/dist/shoppingList.css':['css/style/shoppingList.css'],
					// 'css/dist/shopping.list.css':['css/style/shopping.list.css'],
					// // 详细页
					// 'css/dist/details.css':['css/style/details.css'],
					// 'css/dist/shop-details.css':['css/style/shop-details.css'],

					// 'css/dist/user-reg.css':['css/style/user-reg.css'],

					// //指数
					// 'css/dist/index-list.css':['css/style/index-list.css'],
					// 'css/dist/index-details.css':['css/style/index-details.css'],
					
					// //资质荣誉页面
					// 'css/dist/creditManage.css':['css/style/creditManage.css'],
					// 'css/dist/creditUpload.css':['css/style/creditUpload.css'],
					// 'css/dist/creditDetail.css':['css/style/creditDetail.css'],
					// 'css/dist/creditshop.css':['css/style/creditshop.css'],
					
					// //评价页面
					// 'css/dist/evaluate.css':['css/style/evaluate.css'],
					// 'css/dist/manageEvaluate.css':['css/style/manageEvaluate.css'],

					// //商品发布
					// 'css/dist/release-of-goods.css':['css/style/release-of-goods.css'],
					// 'css/dist/user-release-of-goods.css':['css/style/user-release-of-goods.css'],
					
					// //采购中心
					// 'css/dist/procurementCenter.css':['css/style/procurementCenter.css'],
					
					// //销售中心
					// 'css/dist/marketApplication.css':['css/style/marketApplication.css'],
					// 'css/dist/marketPrepare.css':['css/style/marketPrepare.css'],
					// 'css/dist/marketQuote.css':['css/style/marketQuote.css'],
					// 'css/dist/memberSellList.css':['css/style/memberSellList.css'],
					// 'css/dist/memberSellDetail.css':['css/style/memberSellDetail.css'],
					// 'css/dist/refundList.css':['css/style/refundList.css'],
					// 'css/dist/refundDetail.css':['css/style/refundDetail.css'],
					
					// //商机信息
					// //商机首页
					// 'css/dist/tradeIndex.css':['css/style/tradeIndex.css'],
					// //商机列表
					// 'css/dist/tradeList.css':['css/style/tradeList.css'],
					// //商机详情
					// 'css/dist/tradeDetails.css':['css/style/tradeDetails.css'],
					
					// //供应
					// //供应管理
					// 'css/dist/supplyManage.css':['css/style/supplyManage.css'],
					// //供应详情
					// 'css/dist/supplyDetail.css':['css/style/supplyDetail.css'],
					// //发布供应信息
					// 'css/dist/supplyPublish.css':['css/style/supplyPublish.css'],
					// //询价详情
					// 'css/dist/supplyDetailEnquiry.css':['css/style/supplyDetailEnquiry.css'],
					
					// //账户中心
					// //用户资料
					// 'css/dist/accountManage.css':['css/style/accountManage.css'],
                    // 'css/dist/user_authen_form.css':['css/style/user_authen_form.css'],
                    // 'css/dist/security.css':['css/style/security.css'],
					// //旧版本用户资料
					// 'css/dist/accountManage.old.css':['css/style/accountManage.old.css'],

					// // 提交订单
					// 'css/dist/orderSubmit.css':['css/style/orderSubmit.css'],
					// 'css/dist/order_confirm.css':['css/style/order_confirm.css'],
					// 'css/dist/order_confirm_success.css':['css/style/order_confirm_success.css'],
					
					// // 地利优选
					// 'css/dist/diliFine.css':['css/style/diliFine.css'],
					
                    // 'css/dist/credit_manage.css':['css/style/credit_manage.css'],
					
					// 'css/dist/store_ready.css':['css/style/store_ready.css'],
                    
					// 'css/dist/protocolDemo.css':['css/style/protocolDemo.css'],
					
					// 'newstyle/mini/module.css':['css/module.css'],
					// 'newstyle/mini/myNongFeng.css':['newstyle/myNongFeng.css'],
					// 'newstyle/mini/manageProduct.css':['newstyle/manageProduct.css'],
					// 'newstyle/mini/myPicture.css':['newstyle/myPicture.css'],
					// 'newstyle/mini/addresses_list.css':['newstyle/addresses_list.css'],
					// 'newstyle/mini/buyer_refund_list.css':['newstyle/buyer_refund_list.css'],
					// 'newstyle/mini/buyer_refund_submit.css':['newstyle/buyer_refund_submit.css'],
					// 'newstyle/mini/seller_refund_list.css':['newstyle/seller_refund_list.css'],
					// 'newstyle/mini/seller_refund_submit.css':['newstyle/seller_refund_submit.css'],
					// 'newstyle/mini/recommend_goods.css':['newstyle/recommend_goods.css'],
					// 'newstyle/mini/release-goods.css':['newstyle/release-goods.css'],
					// 'newstyle/mini/user_common.css':['newstyle/user_common.css'],
					// 'newstyle/mini/print.css':['newstyle/print.css'],

				}
            }
		},
		// css 压缩
		cssmin:{
			options: {
                banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
                compatibility : 'ie8', //设置兼容模式 
        		noAdvanced : true //取消高级特性 

            },
// 			css: {
// 				files:{
// 					//首页
// 					'css/dist/index.css':['css/dist/index.css'],
// 					//充值
// 					// 'css/dist/recharge.css':['css/dist/recharge.css'],
// 				}
//             }
			minify: {
			    // expand: true,
			    // cwd: 'css/dist/',
			    // src: ['*.css', '!*.min.css'],
			    // dest: 'css/dist/',
			    // ext: '.css'
        
			    // expand: true,
			    // cwd: 'newstyle/mini/',
			    // src: ['*.css', '!*.min.css'],
			    // dest: 'newstyle/mini/',
			    // ext: '.css'
				
				expand: true,
			    cwd: 'oldCommon/css0.5/',
			    src: ['*.css', '!*.min.css'],
			    dest: 'oldCommon/mini/',
			    ext: '.css'
         
			}
		},
		
		// js压缩
		uglify: {
            //文件头部输出信息
            options: {
				mangle: false,
                banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
				
            },
            build: {

            	files: [{
					expand: true,
					cwd: 'headder-footer',
					src: '**/*.js',
					dest: 'headder-footer/mini'
				}]
				
            }
		},
    imagemin: {
      compress: {
        files: [{
            expand: true,
            cwd: 'images/',
            src: ['**/*.{png,jpg,gif}'],
            dest: 'build/<%= pkg.version %>/images'
          }]
        }
    }
	});
	
	// 合并nn
	grunt.loadNpmTasks( 'grunt-contrib-concat' );
	// 压缩
	grunt.loadNpmTasks( 'grunt-contrib-uglify' );
	//css 合并
	
	grunt.loadNpmTasks('grunt-css-combo');
	grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
	grunt.loadNpmTasks( 'grunt-contrib-imagemin' );


	grunt.registerTask( 'default', [ 
	'css_combo',
	'cssmin',
	'uglify' 
	] );
};