-
Notifications
You must be signed in to change notification settings - Fork 1
/
GruntFile.js
80 lines (72 loc) · 2.5 KB
/
GruntFile.js
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
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-modernizr');
grunt.loadNpmTasks('grunt-contrib-uglify');
var modernizrOutput = 'build/modernizr.js',
uglifyFiles = {
'build/vanilla-popup-modal.js': [
'build/modernizr.js',
'src/**/*.js'
]
};
var gruntConfig = {
libraryName: 'vpm',
modernizr: {
dist: {
'outputFile': modernizrOutput,
'devFile': 'bower_components/modernizr/modernizr.js',
'uglify': false,
'extra': {
'cssclasses': false,
'shiv': false,
'printshiv': false,
'load': false,
'mq': false
},
"extensibility" : {
"addtest" : false,
"prefixed" : false,
"teststyles" : false,
"testprops" : false,
"testallprops" : false,
"hasevents" : false,
"prefixes" : false,
"domprefixes" : false
}
}
},
uglify: {
dev: {
options: {
sourceMap: false,
mangle: false,
beautify: true,
compress: false
},
files: uglifyFiles
},
prod: {
options: {
sourceMap: true,
sourceMapIncludeSources: true,
inSourceMap: "build/vanilla-popup-modal.js.map",
sourceMapName: "build/vanilla-popup-modal.min.js.map",
mangle: true,
beautify: false,
compress: true
},
files: uglifyFiles
}
}
};
grunt.initConfig(gruntConfig);
grunt.registerTask('modernizrClosure', function() {
var output = 'window.' + gruntConfig.libraryName + ' = {}; (function(window){' +
grunt.file.read(modernizrOutput) + '}).bind(window)(' +
gruntConfig.libraryName + ');';
grunt.file.write(modernizrOutput, output);
});
grunt.registerTask('cleanBuild', function() {
grunt.file.delete(modernizrOutput);
})
grunt.registerTask('build:dev', ['modernizr:dist', 'modernizrClosure', 'uglify:dev', 'cleanBuild']);
}