-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgruntfile.js
executable file
·131 lines (128 loc) · 4.25 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*jslint node: true */
module.exports = function (grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
js_desktop: {
src: ['node_modules/node-uuid/uuid.js', 'node_modules/socket.io-client/socket.io.js', 'common/controller/controller.js', 'client/js/GameView.js', 'client/js/main.js', 'client/js/desktop.js'],
dest: 'client/dist.js'
},
js_mobile: {
src: ['node_modules/node-uuid/uuid.js', 'node_modules/socket.io-client/socket.io.js', 'common/controller/controller.js', 'client/js/GameView.js', 'client/js/main.js', 'client/js/tactile.js', 'client/js/mobile.main.js'],
dest: 'client/mobile.dist.js'
},
css_desktop: {
src: ['client/css/main.css', 'client/css/spinner.css'],
dest: 'client/main.css'
},
css_mobile: {
src: ['client/css/mobile.main.css', 'client/css/spinner.css'],
dest: 'client/mobile.main.css'
}
},
uglify : {
main: {
src: "client/dist.js",
dest: "client/dist.js"
},
mobile: {
src: "client/mobile.dist.js",
dest: "client/mobile.dist.js"
}
},
htmlmin: {
dist: {
options: {
removeComments: true,
collapseWhitespace: true
},
files: {
'client/index.html': ['client/html/index.html'],
'client/mobile.html': ['client/html/mobile.html']
}
}
},
cssmin: {
main: {
src: 'client/main.css',
dest: 'client/main.css'
},
mobile: {
src: 'client/mobile.main.css',
dest: 'client/mobile.main.css'
}
},
copy: {
html: {
expand: true,
cwd: 'client/html',
src: '*.html',
dest: 'client/'
}
},
csslint : {
options: {
"ids": false
},
src: ["client/css/*.css"]
},
htmllint: {
all: ["client/html/*.html"]
},
jslint: {
all: ['gruntfile.js', 'common/**/*.js', 'server/*.js', 'client/js/*.js']
},
nodeunit: {
all: ['test/test-*.js']
},
replace: {
dist: {
options: {
patterns: [{
match: 'URL_SOCKETIO_SERVER',
replacement: process.env.SOCKETIO_SERVER || ''
}]
},
files: [{
expand: true,
flatten: true,
src: ['client/*.js'],
dest: 'client'
}]
}
},
exec: {
server : {
command: "node server/app.js"
}
},
inline: {
desktop: {
src: ['client/index.html']
},
mobile: {
src: ['client/mobile.html']
}
},
clean: {
dist: ["client/*.css", "client/*.js"]
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-jslint');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-html');
grunt.loadNpmTasks('grunt-replace');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-inline');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.registerTask('default', ['concat', "replace", 'uglify', "htmlmin", "cssmin", "inline", "clean"]);
grunt.registerTask('dev', ['concat', 'copy', 'replace', 'inline', 'clean', 'exec']);
grunt.registerTask('test', ['jslint', 'csslint', 'htmllint', 'nodeunit', 'default']);
};