forked from FreezingMoon/AncientBeast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
113 lines (110 loc) · 2.47 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
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-watch');
//grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-open');
grunt.loadNpmTasks('grunt-express-server');
grunt.loadNpmTasks('main-bower-files');
// grunt.loadNpmTasks('grunt-uncss');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
banner: 'var $j = jQuery.noConflict();\n\n',
},
dist: {
src: [
"src/sound/**/*.js",
"src/ui/**/*.js",
"src/utility/**/*.js",
"src/network/**/*.js",
"src/*.js",
"src/abilities/**/*.js"
],
dest: 'deploy/scripts/<%= pkg.name %>.js'
}
},
express: {
options: {
port: 8080,
},
server: {
options: {
script: 'server.js'
}
}
},
watch: {
js: {
files: ['src/**/*.js'],
tasks: ['concat'],
},
css: {
files: ['src/less/**/*.less'], // which files to watch
tasks: ['less'],
options: {
nospawn: true
}
}
},
bower: {
flat: { /* flat folder/file structure */
dest: 'deploy/scripts/libs',
options: {
env: process.env.NODE_ENV || "development"
}
}
},
copy: {
// Copies CSS files into deploy/css, these were previously in deploy/css
// but were moved to enabled gitignore to work more cleanly on that path.
css: {
files: [{
expand: true,
cwd: 'src/css',
src: ['**'],
dest: 'deploy/css',
}]
}
},
open: {
dev: {
path: 'http://localhost:8080/index.html'
}
},
// Compile less files into deploy/css path.
less: {
production: {
options: {
compress: true,
paths: ['src/less'],
plugins: [
// new(require('less-plugin-autoprefix'))({
// browsers: ["last 2 versions"]
// }),
new(require('less-plugin-clean-css'))({
inline: ['local', 'remote']
})
],
},
files: {
'deploy/css/main.css': 'src/less/main.less'
}
}
},
// This needs a bit of tweaking to work right but potentially huge savingsin CSS size -- ktiedt
// uncss: {
// dist: {
// files: {
// 'deploy/css/main.css': ['deploy/index.html']
// },
// options: {
// report: 'min' // optional: include to report savings
// }
// }
// }
});
grunt.registerTask('default', ['concat', 'less', 'copy', 'bower', /* 'uncss', */ 'express', 'open', 'watch']);
};