-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
183 lines (168 loc) · 6.44 KB
/
Gruntfile.js
File metadata and controls
183 lines (168 loc) · 6.44 KB
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/* jshint node: true, indent: 4 */
module.exports = function(grunt) {
"use strict";
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
versions: {
jQuery: "2.1.1",
Sizzle: "1.10.19",
Bootstrap: "3.2.0"
},
clean: ["build/*"], // Empty the build directory
concat: {
options: {
stripBanners: true, // /* - trimmed /*! - not trimmed
//banner: "",
separator: ";\n"
},
jqueryBootstrapJS: {
src: [
"src/public/js/shared/jquery-2.1.1.js",
"src/public/js/shared/bootstrap.js"
],
dest: "build/public/js/shared.js"
},
bootstrapCSS: {
src: [
"src/public/css/shared/bootstrap.css",
"src/public/css/shared/bootstrap-theme.css"
],
dest: "build/public/css/bootstrap-all.css"
}
},
copy: {
main: {
files: [
{expand: true, cwd: "src/modules/", src: "*", dest: "build/modules/", filter: "isFile"},
{expand: true, cwd: "src/", src: "server.js", dest: "build/", filter: "isFile"},
{expand: true, cwd: "src/public/html/", src: "**", dest: "build/public/html/"},
{expand: true, cwd: "src/public/css/", src: "*", dest: "build/public/css/", filter: "isFile"},
{expand: true, cwd: "src/public/fonts/", src: "**", dest: "build/public/fonts/"}
]
}
},
cssmin: {
cssMinifying: {
files: [
{expand: true, cwd: "build/public/css/", src: "**/*.css", dest: "build/public/css/", ext: ".min.css"}
]
}
},
uglify: {
options: {
preserveComments: false,
mangle: false,
report: "min"
},
publicJavaScript: {
filter: function(filePath) {
return (filePath.indexOf("shared") === -1);
},
expand: true, cwd: "build/public/js/", src: "**/*.js", dest: "build/public/js/", ext: ".min.js"
},
sharedJavaScript: {
options: {
banner: "/*!\n"+
" * <%= pkg.name %> - v<%= pkg.version %>\n"+
" * This file contains\n"+
" * jQuery v<%= versions.jQuery %>, Sizzle v<%= versions.Sizzle %> (c) 2005, 2014 jQuery Foundation, Inc. (https://jquery.com) MIT license\n"+
" * Bootstrap v<%= versions.Bootstrap %> (c) 2011-2014 Twitter, Inc. (http://getbootstrap.com) MIT license\n"+
" */\n"
},
src: "build/public/js/shared.js",
dest: "build/public/js/shared.min.js"
},
ember: {
files: [
{expand: true, cwd: "build/public/ember/", src: "**/*.js", dest: "build/public/ember/", ext: ".min.js"}
]
}
},
compress: {
gzip: {
options: {
mode: "gzip",
level: 9
},
files: [
{expand: true, cwd: "build/public/js/", src: ["**/*"], dest: "build/public/js/", extDot: "last", ext: ".js.gz"},
{expand: true, cwd: "build/public/css/", src: ["**/*"], dest: "build/public/css/", extDot: "last", ext: ".css.gz"},
{expand: true, cwd: "build/public/html/", src: ["**/*"], dest: "build/public/html/", extDot: "last", ext: ".html.gz"},
{src: "build/public/fonts/glyphicons-halflings-regular.eot", dest: "build/public/fonts/glyphicons-halflings-regular.eot.gz"},
{src: "build/public/fonts/glyphicons-halflings-regular.svg", dest: "build/public/fonts/glyphicons-halflings-regular.svg.gz"},
{src: "build/public/fonts/glyphicons-halflings-regular.ttf", dest: "build/public/fonts/glyphicons-halflings-regular.ttf.gz"},
{src: "build/public/fonts/glyphicons-halflings-regular.woff", dest: "build/public/fonts/glyphicons-halflings-regular.woff.gz"}
]
}
},
jshint: {
grunt: {
options: {
node: true // http://www.jshint.com/docs/options/#node
},
src: "Gruntfile.js"
},
browser: {
options: {
curly: true, // http://www.jshint.com/docs/options/#curly
eqeqeq: true, // http://www.jshint.com/docs/options/#eqeqeq
immed: true, // http://www.jshint.com/docs/options/#immed
indent: 4, // http://www.jshint.com/docs/options/#indent
latedef: true, // http://www.jshint.com/docs/options/#latedef
noarg: true, // http://www.jshint.com/docs/options/#noarg
nonbsp: true, // http://www.jshint.com/docs/options/#nonbsp
nonew: true, // http://www.jshint.com/docs/options/#nonew
undef: true, // http://www.jshint.com/docs/options/#undef
unused: "vars", // http://www.jshint.com/docs/options/#unused
strict: true, // http://www.jshint.com/docs/options/#strict
asi: true, // http://www.jshint.com/docs/options/#asi
eqnull: true, // http://www.jshint.com/docs/options/#eqnull
browser: true, // http://www.jshint.com/docs/options/#browser
devel: true, // http://www.jshint.com/docs/options/#devel
jquery: true // http://www.jshint.com/docs/options/#jquery
},
src: ["build/public/js/**/*.js"],
filter: function(filePath) {
// since ignores won't work as I want it to I wrote this code to ignore the shared js files.
return (filePath.indexOf("shared") === -1 && filePath.indexOf("min.js") === -1);
}
},
node: {
options: {
curly: true, // http://www.jshint.com/docs/options/#curly
eqeqeq: true, // http://www.jshint.com/docs/options/#eqeqeq
immed: true, // http://www.jshint.com/docs/options/#immed
indent: 4, // http://www.jshint.com/docs/options/#indent
latedef: true, // http://www.jshint.com/docs/options/#latedef
noarg: true, // http://www.jshint.com/docs/options/#noarg
nonbsp: true, // http://www.jshint.com/docs/options/#nonbsp
nonew: true, // http://www.jshint.com/docs/options/#nonew
undef: true, // http://www.jshint.com/docs/options/#undef
eqnull: true, // http://www.jshint.com/docs/options/#eqnull
node: true // http://www.jshint.com/docs/options/#node
},
src: ["build/*.js", "build/modules/**/*.js"]
}
},
htmlmin: {
dist: {
options: {
removeComments: false,
collapseWhitespace: true
},
files: [
{expand: true, cwd: "build/public/html/", src: "**/*.html", dest: "build/public/html/", ext: ".min.html"}
]
}
}
});
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-cssmin");
grunt.loadNpmTasks("grunt-contrib-compress");
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-htmlmin");
grunt.registerTask("default", ["clean", "concat", "copy", /*"htmlmin", */"uglify", "cssmin", "compress"]);
};