This repository has been archived by the owner on Oct 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGruntfile.js
114 lines (112 loc) · 2.84 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
// Require grunt and it's dependencies listed in package.json
// > run "npm install" in the game root folder
// Use this file to validate all js and json,
// bundle and minify the game js and css,
// and create the game electron executables
// > run "grunt" in the game root folder
module.exports = function(grunt) {
grunt.initConfig({
'pkg': grunt.file.readJSON('package.json'),
'jshint': {
options: {
reporterOutput: "",
laxcomma: true
},
all: [
'package.json',
'Gruntfile.js',
'server.js',
'client/json/**/*.json',
'client/js/**/*.js'
]
},
'cssmin': {
target: {
files: [{
expand: true,
cwd: 'client/css',
src: ['*.css'],
dest: 'client/bundle/css',
ext: '.min.css'
}]
}
},
'uglify': {
options: {
banner: '// <%= pkg.name %> grunt <%= grunt.template.today("yyyy-mm-dd h:MM:ss TT") %> */\n'
},
target: {
files: [{
src: 'client/js/game.js',
dest: 'client/bundle/js/game.min.js',
},{
src: 'client/js/*/*.js',
dest: 'client/bundle/js/after.min.js'
}]
}
},
'concat': {
css: {
src: [
'client/browser_modules/**/*.min.css',
'client/bundle/css/*.min.css'
],
dest: 'client/bundle/game.min.css'
},
js: {
src: [
'client/browser_modules/**/*.min.js',
'client/bundle/js/game.min.js',
'client/bundle/js/after.min.js'
],
dest: 'client/bundle/game.min.js'
}
},
'clean': [
'client/bundle/js',
'client/bundle/css'
],
'electron': {
winBuild: {
options: {
asar: true,
overwrite: true,
dir: 'client',
out: 'downloads/windows',
electronVersion: '3.0.10',
platform: 'win32',
arch: 'ia32'
}
},
macosBuild: {
options: {
asar: true,
overwrite: true,
dir: 'client',
out: 'downloads/mac',
electronVersion: '3.0.10',
platform: 'darwin',
arch: 'x64'
}
},
linuxBuild: {
options: {
asar: true,
overwrite: true,
dir: 'client',
out: 'downloads/linux',
electronVersion: '3.0.10',
platform: 'linux',
arch: 'ia32'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-electron');
grunt.registerTask('default', ['jshint', 'cssmin', 'uglify', 'concat', 'clean', 'electron']);
};