-
Notifications
You must be signed in to change notification settings - Fork 8
/
Gruntfile.js
117 lines (112 loc) · 2.68 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*global module:false*/
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-sass');
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
meta: {
jsfiles: [
'www/static/js/q.js',
'www/static/js/EventEmitter.js',
'www/static/js/ji/index.js',
'www/static/js/ji/utils.js',
'www/static/js/ji/Ship.js',
'www/static/js/ji/Flash.js',
'www/static/js/ji/Shot.js',
'www/static/js/ji/Explosion.js',
'www/static/js/ji/Level.js',
'www/static/js/ji/Intro.js',
'www/static/js/ji/Summary.js',
'www/static/js/main.js'
]
},
concat: {
options: {
separator: '\n;\n'
},
all: {
files: {
'www/static/js/all.js': '<%= meta.jsfiles %>'
}
}
},
jshint: {
all: '<%= meta.jsfiles %>',
options: {
curly: true,
forin: true,
immed: true,
indent: 2,
latedef: true,
newcap: true,
noarg: true,
nonew: true,
sub: true,
undef: true,
unused: true,
boss: true,
eqnull: true,
browser: true,
devel: true,
globals: []
}
},
uglify: {
options: {
mangle: {
except: []
},
sourceMap: 'www/static/js/all.js.map',
sourceMappingURL: 'all.js.map',
sourceMapPrefix: 3
},
all: {
files: {
'www/static/js/all.js': '<%= meta.jsfiles %>'
}
}
},
sass: {
dev: {
options: {
lineNumbers: true,
debugInfo: true
},
files: {
'www/static/css/all.css': 'www/static/css/all.scss'
}
},
dist: {
options: {
style: 'compressed'
},
files: {
'www/static/css/all.css': 'www/static/css/all.scss'
}
}
},
watch: {
scripts: {
files: '<%= meta.jsfiles %>',
tasks: ['concat']
},
styles: {
files: 'www/static/css/*.scss',
tasks: ['sass:dev']
}
}
});
grunt.registerTask('server', function() {
require('./index.js');
});
grunt.registerTask('buildStatic', function() {
var done = this.async();
require('./build-static.js')(done);
});
grunt.registerTask('dev', ['concat', 'sass:dev', 'server', 'watch']);
grunt.registerTask('build', ['concat', 'uglify', 'sass:dist', 'server', 'buildStatic']);
};