forked from wet-boew/wet-boew-styleguide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.coffee
351 lines (325 loc) · 6.7 KB
/
Gruntfile.coffee
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
#global module:false
module.exports = (grunt) ->
# Default task.
@registerTask(
"default"
"Default task, that runs the production build"
[
"dist"
]
)
@registerTask(
"dist"
"Produces the production files"
[
"clean:dist"
"copy:wetboew"
"copy:v3_styleguide"
"copy:v3_menu"
"copy:assets"
"css"
"assemble"
]
)
@registerTask(
"init"
"Only needed when the repo is first cloned"
[
"install-dependencies"
"hub"
]
)
@registerTask(
"server"
"Run the Connect web server for local repo"
[
"connect:server:keepalive"
]
)
@registerTask(
"deploy"
"Build and deploy artifacts to wet-boew-dist"
[
"dist"
"copy:deploy"
"gh-pages:travis"
]
)
@registerTask(
"css"
"Build and deploy artifacts to wet-boew-dist"
[
"sass:all"
"autoprefixer"
#"csslint:unmin"
"cssmin:v4"
]
)
@initConfig
pkg: @file.readJSON "package.json"
jqueryVersion: @file.readJSON "lib/jquery/bower.json"
jqueryOldIEVersion: @file.readJSON "lib/jquery-oldIE/bower.json"
banner: "/*!\n * Web Experience Toolkit (WET) / Boîte à outils de l'expérience Web (BOEW)\n * wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html\n" +
" * <%= pkg.version %> - " + "<%= grunt.template.today('yyyy-mm-dd') %>\n *\n */"
assemble:
options:
prettify:
indent: 2
marked:
sanitize: false
production: false
data: [
"lib/wet-boew/site/data/**/*.{yml,json}"
"site/data/**/*.{yml,json}"
]
helpers: [
"lib/wet-boew/site/helpers/helper-*.js"
"site/helpers/helper-*.js"
]
partials: [
"lib/wet-boew/site/includes/**/*.hbs"
"site/includes/**/*.hbs"
]
layoutdir: "lib/wet-boew/site/layouts"
layout: "default.hbs"
environment:
suffix: ".min"
jqueryVersion: "<%= jqueryVersion.version %>"
jqueryOldIEVersion: "<%= jqueryOldIEVersion.version %>"
guides:
options:
assets: "dist/v4"
files: [
#site
expand: true
cwd: "site/pages"
src: [
"**/*.hbs",
"!index.hbs"
]
dest: "dist"
]
splash:
options:
layout: "splashpage.hbs"
assets: "dist"
cwd: "site/pages"
src: [
"index.hbs"
]
dest: "dist"
expand: true
copy:
wetboew:
expand: true
cwd: "lib/wet-boew/dist"
src: [
"**/*.*"
"!demos/**/*.*"
"!unmin/**/*.*"
]
dest: "dist/v4"
assets:
expand: true
cwd: "site/pages/v4"
src: [
"**/images/*.*"
]
dest: "dist/v4"
deploy:
src: [
"*.txt"
"README.md"
]
dest: "dist"
expand: true
v3_styleguide:
expand: true
cwd: "old/"
src: [
"*.html"
"dist/dist/**/*.*"
]
dest: "dist/v3"
v3_menu:
expand: true
cwd: "old/dist/demos"
src: [
"includes/projectmenu-*.txt"
]
dest: "dist/v3"
# Compiles the Sass files
sass:
all:
files: [
expand: true
cwd: "site/pages/v4"
src: [
"**/*.scss"
]
dest: "dist/v4"
ext: ".css"
]
autoprefixer:
# Only vendor prefixing and no IE8
modern:
options:
browsers: [
"last 2 versions"
"android >= 2.3"
"bb >= 7"
"ff >= 17"
"ie > 8"
"ios 5"
"opera 12.1"
]
cwd: "dist/v4"
src: [
"**/*.css"
"!ie8*.css"
]
dest: "dist/v4"
expand: true
# Needs both IE8 and vendor prefixing
mixed:
options:
browsers: [
"last 2 versions"
"android >= 2.3"
"bb >= 7"
"ff >= 17"
"ie >= 8"
"ios 5"
"opera 12.1"
]
files: [
cwd: "dist/v4"
src: [
"**/*.css"
"!**/*.min.css"
]
dest: "dist/v4"
expand: true
flatten: true
]
# Only IE8 support
oldIE:
options:
browsers: [
"ie 8"
]
cwd: "dist/v4"
src: [
"ie8*.css"
]
dest: "dist/v4"
expand: true
flatten: true
csslint:
options:
"adjoining-classes": false
"box-model": false
"box-sizing": false
"compatible-vendor-prefixes": false
"duplicate-background-images": false
"duplicate-properties": false
# Can be turned off after https://github.com/dimsemenov/Magnific-Popup/pull/303 lands
"empty-rules": false
"fallback-colors": false
"floats": false
"font-sizes": false
"gradients": false
"headings": false
"ids": false
"important": false
# Need due to use of "\9" hacks for oldIE
"known-properties": false
"outline-none": false
"overqualified-elements": false
"qualified-headings": false
"regex-selectors": false
# Some Bootstrap mixins end up listing all the longhand properties
"shorthand": false
"text-indent": false
"unique-headings": false
"universal-selector": false
"unqualified-attributes": false
# Zeros are output by some of the Bootstrap mixins, but shouldn't be used in our code
"zero-units": false
cssmin:
options:
banner: ""
v4:
options:
banner: ""
expand: true
cwd: "dist/v4"
src: [
"**/*.css"
]
dest: "dist/v4"
ext: ".min.css"
clean:
dist: ["dist"]
lib: ["lib"]
non_mincss:
expand: true
src: [
"dist/**/*.css"
"!dist/**/*.min.css"
]
jsUncompressed: ["dist/js/**/*.js", "!dist/js/**/*<%= environment.suffix %>.js"]
hub:
"wet-boew":
src: [
"lib/wet-boew/Gruntfile.coffee"
]
tasks: [
"build"
"minify"
"assets-min"
"pages:ajax"
"pages:min"
]
"install-dependencies":
options:
cwd: "lib/wet-boew"
failOnError: false
isDevelopment: true
"gh-pages":
options:
base: "dist"
travis:
options:
repo: "https://" + process.env.GH_TOKEN + "@github.com/wet-boew/wet-boew-styleguide.git"
message: "Travis build " + process.env.TRAVIS_BUILD_NUMBER
silent: true
src: [
"**/*.*"
]
connect:
options:
port: 8000
server:
options:
base: "dist"
middleware: (connect, options, middlewares) ->
middlewares.unshit(connect.compress(
filter: (req, res) ->
/json|text|javascript|dart|image\/svg\+xml|application\/x-font-ttf|application\/vnd\.ms-opentype|application\/vnd\.ms-fontobject/.test(res.getHeader('Content-Type'))
))
middlewares
# These plugins provide necessary tasks.
@loadNpmTasks "assemble"
@loadNpmTasks "grunt-autoprefixer"
@loadNpmTasks "grunt-contrib-clean"
@loadNpmTasks "grunt-contrib-connect"
@loadNpmTasks "grunt-contrib-copy"
@loadNpmTasks "grunt-contrib-csslint"
@loadNpmTasks "grunt-contrib-cssmin"
@loadNpmTasks "grunt-gh-pages"
@loadNpmTasks "grunt-hub"
@loadNpmTasks "grunt-install-dependencies"
@loadNpmTasks "grunt-sass"
require( "time-grunt" )( grunt )
@