gruntfile

来源:互联网 发布:数学学术论文知乎 编辑:程序博客网 时间:2024/05/02 04:37

{  "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