schangxiang@126.com
2025-09-17 c9c91ad3e3ac218d81c86809c93a35622b51a686
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
82
83
84
85
86
87
88
89
90
module.exports = function(grunt) {
    "use strict";
 
    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        banner:
                        '/*! Respond.js v<%= pkg.version %>: <%= pkg.description %>' +
                        ' * Copyright <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
                        ' * Licensed under <%= _.pluck(pkg.licenses, "url").join(", ") %>\n' +
                        ' * <%= pkg.website %>' +
                        ' */\n\n',
        uglify: {
            nonMinMatchMedia: {
                options: {
                    mangle: false,
                    compress: false,
                    preserveComments: 'some',
                    beautify: {
                        beautify: true,
                        indent_level: 2
                    }
                },
                files: {
                    'dest/respond.src.js': ['src/matchmedia.polyfill.js', 'src/respond.js']
                }
            },
            minMatchMedia: {
                options: {
                    banner: '<%= banner %>'
                },
                files: {
                    'dest/respond.min.js': ['src/matchmedia.polyfill.js', 'src/respond.js']
                }
            },
            nonMinMatchMediaListener: {
                options: {
                    mangle: false,
                    compress: false,
                    preserveComments: 'some',
                    beautify: {
                        beautify: true,
                        indent_level: 2
                    }
                },
                files: {
                    'dest/respond.matchmedia.addListener.src.js': ['src/matchmedia.polyfill.js', 'src/matchmedia.addListener.js', 'src/respond.js']
                }
            },
            minMatchMediaListener: {
                options: {
                    banner: '<%= banner %>'
                },
                files: {
                    'dest/respond.matchmedia.addListener.min.js': ['src/matchmedia.polyfill.js', 'src/matchmedia.addListener.js', 'src/respond.js']
                }
            }
        },
        jshint: {
            files: ['src/respond.js', 'src/matchmedia.polyfill.js'],
            options: {
                curly: true,
                eqeqeq: true,
                immed: true,
                latedef: false,
                newcap: true,
                noarg: true,
                sub: true,
                undef: true,
                boss: true,
                eqnull: true,
                smarttabs: true,
                node: true,
                es5: true,
                strict: false
            },
            globals: {
                Image: true,
                window: true
            }
        }
    });
 
    grunt.loadNpmTasks( 'grunt-contrib-jshint' );
    grunt.loadNpmTasks( 'grunt-contrib-uglify' );
 
    // Default task.
    grunt.registerTask('default', ['jshint', 'uglify']);
 
};