gruntfile

3 篇文章 0 订阅

{
  "name": "123",
  "version": "1.0.0",
  "description": "tosone",
  "main": "Gruntfile.js",
  "dependencies": {},
  "devDependencies": {
    "grunt": "^0.4.5",
    "grunt-contrib-clean": "^0.6.0",
    "grunt-contrib-copy": "^0.7.0",
    "grunt-contrib-cssmin": "^0.11.0",
    "grunt-contrib-htmlmin": "^0.3.0",
    "grunt-contrib-uglify": "^0.7.0",
    "grunt-rev": "^0.1.0",
    "grunt-usemin": "^3.0.0",
    "load-grunt-tasks": "^2.0.0",
    "time-grunt": "^1.0.0"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "tosone",
  "license": "ISC"
}

'use strict';
module.exports = function(grunt) {
	require('load-grunt-tasks')(grunt);
	require('time-grunt')(grunt);
	grunt.loadNpmTasks('grunt-rev');
	grunt.loadNpmTasks('grunt-contrib-htmlmin');
	grunt.loadNpmTasks('grunt-contrib-cssmin');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-usemin');
	var config = {
		app: "app",
		dist: "dist"
	};
	grunt.initConfig({
		config: config,
		clean: {
			dist: {
				files: [{
					src: [
						'<%= config.dist %>/**/*',
						'!<%= config.dist %>/.git'
					]
				}]
			}
		},
		copy: {
			dist: {
				files: [{
					expand: true,
					cwd: '<%= config.app %>/',
					src: ['**/*.{php,png,jpg,bmp,ico,jpeg,ttf,svg,woff,eot,mp4,mp3,swf}'],
					dest: '<%= config.dist %>/'
				}]
			}
		},
		htmlmin: {
			dist: {
				options: {
					removeComments: true,
					collapseWhitespace: true
				},
				files: [{
					expand: true,
					cwd: '<%= config.app %>/',
					src: ['**/*.html'],
					dest: '<%= config.dist %>/'
				}]
			}
		},
		uglify: {
			dist: {
				files: [{
					expand: true,
					cwd: '<%= config.app %>/',
					src: ['**/*.js'],
					dest: '<%= config.dist %>/'
				}]
			}
		},
		cssmin: {
			dist: {
				files: [{
					expand: true,
					cwd: '<%= config.app %>/',
					src: ['**/*.css'],
					dest: '<%= config.dist %>/'
				}]
			}
		},
		rev: {
			options: {
				algorithm: 'md5',
				length: 8
			},
			dist: {
				files: [{
					src: ['<%= config.dist %>/**/*.{js,css,png,jpg,bmp,ico,jpeg,ttf,svg,woff,eot,mp4,mp3,swf}'],
					dest: '<%= config.dist %>/123/'
				}]
			}
		},
		usemin: {
			css: '<%= config.dist %>/**/*.css',
			html: '<%= config.dist %>/**/*.html',
			js: '<%= config.dist %>/**/*.js',
		}
	})
	grunt.registerTask('build', ['clean', 'copy', 'uglify', 'htmlmin', 'cssmin', 'rev', 'usemin']);
}



















  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值