This repository was archived by the owner on Oct 26, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathGruntfile.js
75 lines (64 loc) · 1.75 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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: '\n',
banner: "(function(global) {",
footer: "}(this));"
},
dist: {
src: grunt.file.readJSON('config.json'),
dest: 'dist/GLMap/<%=pkg.name%>.debug.js'
}
},
uglify: {
options: {},
build: {
src: 'dist/GLMap/<%=pkg.name%>.debug.js',
dest: 'dist/GLMap/<%=pkg.name%>.js'
}
},
copy: {
dist: [{
src: 'src/style.css',
dest: 'dist/GLMap/GLMap.css'
}]
},
shaders: {
dist: {
src: 'src/shaders',
dest: 'src/Shaders.min.js'
}
},
jshint: {
options: {
globals: {
Map: true
}
},
all: grunt.file.readJSON('config.json')
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.registerMultiTask('copy', 'Copy Files', function() {
var fs = require('fs');
var config = grunt.config.data.copy.dist;
for (var i = 0; i < config.length; i++) {
fs.writeFileSync(config[i].dest, fs.readFileSync(config[i].src));
}
});
grunt.registerTask('default', 'Development build', function() {
grunt.log.writeln('\033[1;36m'+ grunt.template.date(new Date(), 'yyyy-mm-dd HH:MM:ss') +'\033[0m');
grunt.task.run('copy');
grunt.task.run('concat');
grunt.task.run('uglify');
});
grunt.registerTask('release', 'Release', function() {
grunt.log.writeln('\033[1;36m'+ grunt.template.date(new Date(), 'yyyy-mm-dd HH:MM:ss') +'\033[0m');
grunt.task.run('jshint');
grunt.task.run('default');
});
};