Blame view

web/admin/Gruntfile.js 2.24 KB
457eed6f   xu   app-api
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
module.exports = function(grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        //concat: {
        //    options: {
        //        separator: ';',
        //        stripBanners: true
        //    },
        //    dist: {
        //        src: [
        //        ],
        //        dest: ""
        //    }
        //},
        copy: {
            all: {
                expand: true,
                cwd: 'exts-src',
                src: [
                    '**/*.jpg',
                    '**/*.gif',
                    '**/*.png',
                    '**/*.eot',
                    '**/*.svg',
                    '**/*.ttf',
                    '**/*.woff',
                    '**/*.woff2',
                    '**/*.swf'
                ],
                dest: 'exts'
            }
        },
        uglify: {
            options: {
                stripBanners: true
            },
            build_exts:{
                options: {
                    mangle: false //混淆变量名
                },
                files: [
                    {
                        expand:true,
                        cwd:'exts-src',//modules-src 目录下
                        src:'**/*.js',//所有js文件
                        dest: 'exts'//输出到此目录下
                    }
                ]
            }
        },
        cssmin: {
            options: {
                keepSpecialComments: 0,
            },
            compress: {
                files: [
                    {
                        expand: true,
                        cwd: 'exts-src',
                        src: ['**/*.css'],
                        dest: 'exts'
                    }
                ]
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-concat');//合并JS文件
    grunt.loadNpmTasks('grunt-contrib-uglify');//js 压缩
    grunt.loadNpmTasks('grunt-contrib-cssmin');//css 压缩
    grunt.loadNpmTasks('grunt-contrib-jshint');//js 语法检查
    grunt.loadNpmTasks('grunt-contrib-csslint');//css 语法检查
    grunt.loadNpmTasks('grunt-contrib-copy');//复制文件

    grunt.registerTask('default', [
            'copy',
            'uglify:build_exts',
            'cssmin'
        ]
    );
}