-
Notifications
You must be signed in to change notification settings - Fork 7
/
Gruntfile.js
60 lines (54 loc) · 1.69 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
module.exports = function(grunt){
var pkg = grunt.file.readJSON('package.json'), deps = pkg.devDependencies;
for(var plugin in deps){ if(plugin.match(/^grunt\-/)){ grunt.loadNpmTasks(plugin);}}
var fs = require('fs');
var banner_min = fs.readFileSync('./src/common/banner_min.js', 'utf-8');
var banner_full = fs.readFileSync('./src/common/banner_full.js', 'utf-8');
var PRODUCTION = (grunt.cli.tasks.indexOf('release') >= 0);
grunt.initConfig({
pkg: pkg,
concat: {
options: {
banner: banner_full,
process: true,
},
pzpr: {
options: {
sourceMap: !PRODUCTION
},
files: [
{ src: require('./src/pzpr.js').files, dest: 'dist/pzpr.concat.js' }
]
}
},
uglify: {
options: {
banner: banner_min,
report: 'min'
},
pzpr:{
options: (PRODUCTION ? {} : {
sourceMap : 'dist/pzpr.js.map',
sourceMapIn : 'dist/pzpr.concat.js.map',
sourceMapIncludeSources : true
}),
files: [
{ src: 'dist/pzpr.concat.js', dest: 'dist/pzpr.js'}
]
},
variety:{
options: (PRODUCTION ? {} : {
sourceMap : function(filename){ return filename+'.map';}
}),
files: [
{ expand: true, cwd: 'src/variety', src: ['*.js'], dest: 'dist/pzpr-variety' }
]
}
}
});
grunt.registerTask('default', ['build']);
grunt.registerTask('release', ['build']);
grunt.registerTask('build', ['build:pzpr', 'build:variety']);
grunt.registerTask('build:pzpr', ['newer:concat:pzpr', 'newer:uglify:pzpr']);
grunt.registerTask('build:variety',['newer:uglify:variety']);
};