-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.coffee
401 lines (368 loc) · 12.5 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
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# Grunt Configuration
# http://gruntjs.com/getting-started#an-example-gruntfile
module.exports = (grunt) ->
# Initiate the Grunt configuration.
grunt.initConfig
# Allow use of the package.json data.
pkg: grunt.file.readJSON('package.json')
# docpad variables
docpad:
files: ['./src/**/*.*']
out: ['out']
# concat files
concat:
bootstrap:
src: [
'bower_components/bootstrap-less/js/transition.js',
'bower_components/bootstrap-less/js/alert.js',
'bower_components/bootstrap-less/js/button.js',
'bower_components/bootstrap-less/js/carousel.js',
'bower_components/bootstrap-less/js/collapse.js',
'bower_components/bootstrap-less/js/dropdown.js',
'bower_components/bootstrap-less/js/modal.js',
'bower_components/bootstrap-less/js/tooltip.js',
'bower_components/bootstrap-less/js/popover.js',
'bower_components/bootstrap-less/js/scrollspy.js',
'bower_components/bootstrap-less/js/tab.js',
'bower_components/bootstrap-less/js/affix.js',
'bower_components/jasny-bootstrap/js/offcanvas.js',
'bower_components/jasny-bootstrap/js/inputmask.js',
'bower_components/bootstrapValidator/dist/js/bootstrapValidator.js'
]
dest: 'out/vendor/bootstrap/js/bootstrap.js'
# Use Uglify to minify files.
uglify:
options:
preserveComments: 'some'
bootstrap:
src: '<%= concat.bootstrap.dest %>'
dest: 'out/vendor/bootstrap/js/bootstrap.min.js'
# modernizr:
# src: 'bower_components/modernizr/modernizr.js'
# dest: 'out/vendor/modernizr/modernizr.min.js'
sticky:
src: 'bower_components/sticky/jquery.sticky.js'
dest: 'out/vendor/sticky/jquery.sticky.min.js'
# compile less and generate map files
less:
compileBoss:
options:
compress: true
strictMath: true
sourceMap: true
outputSourceFiles: true
sourceMapURL: 'bossrevolution.css.map'
sourceMapFilename: 'out/styles/bossrevolution.css.map'
files:
'out/styles/bossrevolution.css': 'src/raw/styles/bossrevolution.css.less'
compileBossLanding:
options:
compress: true
strictMath: true
sourceMap: true
outputSourceFiles: true
sourceMapURL: 'bossrevolution-landing.css.map'
sourceMapFilename: 'out/styles/bossrevolution-landing.css.map'
files:
'out/styles/bossrevolution-landing.css': 'src/raw/styles/bossrevolution-landing.css.less'
compileBootstrap:
options:
compress: true
strictMath: true
sourceMap: true
outputSourceFiles: true
sourceMapURL: 'bootstrap.css.map'
sourceMapFilename: 'out/styles/bootstrap.css.map'
files:
'out/styles/bootstrap.css': 'src/raw/styles/bootstrap.css.less'
compileBootstrapLanding:
options:
compress: true
strictMath: true
sourceMap: true
outputSourceFiles: true
sourceMapURL: 'bootstrap.css.map'
sourceMapFilename: 'out/styles/bootstrap-landing.css.map'
files:
'out/styles/bootstrap-landing.css': 'src/raw/styles/bootstrap-landing.css.less'
compileBsTheme:
options:
compress: true
strictMath: true
sourceMap: true
outputSourceFiles: true
sourceMapURL: 'bootstrap-theme.css.map'
sourceMapFilename: 'out/styles/bootstrap-theme.css.map'
files:
'out/styles/bootstrap-theme.css': 'src/raw/styles/bootstrap-theme.css.less'
# add vendor prefixes
autoprefixer:
options:
browsers: [
'Android 2.3',
'Android >= 4',
'Chrome >= 20',
'Firefox >= 24',
'Explorer >= 8',
'iOS >= 6',
'Opera >= 12',
'Safari >= 6'
]
bosssrc:
options:
map: true
src: 'src/raw/styles/*.less'
bossout:
options:
map: true
src: 'out/styles/bossrevolution.css'
modernizr:
dist:
# [REQUIRED] Path to the build you're using for development.
devFile: "bower_components/modernizr/modernizr.js"
# Path to save out the built file.
outputFile: "out/vendor/modernizr/modernizr.min.js"
# Based on default settings on http://modernizr.com/download/
extra:
shiv: true
printshiv: false
load: true
mq: true
cssclasses: true
# Based on default settings on http://modernizr.com/download/
extensibility:
addtest: false
prefixed: false
teststyles: false
testprops: false
testallprops: false
hasevents: false
prefixes: false
domprefixes: false
cssclassprefix: ""
# By default, source is uglified before saving
uglify: true
# Define any tests you want to implicitly include.
tests: []
# By default, this task will crawl your project for references to Modernizr tests.
# Set to false to disable.
parseFiles: true
# When parseFiles = true, this task will crawl all *.js, *.css, *.scss and *.sass files,
# except files that are in node_modules/.
# You can override this by defining a "files" array below.
files:
src: [
'src/raw/**/*.less'
'src/documents/**/*.css'
'src/documents/**/*.js'
]
# This handler will be passed an array of all the test names passed to the Modernizr API, and will run after the API call has returned
# handler: function (tests) {},
# When parseFiles = true, matchCommunityTests = true will attempt to
# match user-contributed tests.
matchCommunityTests: true
# Have custom Modernizr tests? Add paths to their location here.
customTests: []
# rasterize all SVG files in "img" and its subdirectories to "img/png"
svg2png:
out:
files: [
cwd: 'out/img/',
src: ['**/*.svg'],
dest: 'out/img/'
]
src:
files: [
cwd: 'src/raw/img/',
src: ['**/*.svg'],
dest: 'src/raw/img/'
]
icons:
files: [
expand: false,
cwd: 'src/raw/icons/svg/',
src: ['*.svg'],
dest: 'src/raw/icons/png/',
]
#create one svg from multiple files
svgstore:
options:
prefix: 'i--'
#formatting:
# indent_size: 2
includedemo: true
default:
options:
cleanup: ['fill']
files:
'src/raw/icons/svg-defs.svg': ['src/raw/icons/svg/*.svg']
colored:
files:
'src/raw/icons/svg-defs-colored.svg': ['src/raw/icons/svg-color/*.svg']
#convert content of svg file to string
svg2string:
icons:
files:
'src/raw/icons/svg-icons.js': ['src/raw/icons/svg-defs.svg', 'src/raw/icons/svg-defs-colored.svg']
# background-image svg and png sprites
'svg-sprites':
icons:
options:
spriteElementPath: 'src/raw/icons/svg'
spritePath: 'src/raw/icons/icons-sprite.svg'
cssPath: 'src/raw/styles/_sprite.less'
previewPath: 'src/raw/icons/'
prefix: 'i-'
cssSvgPrefix: '.svg '
cssPngPrefix: '.no-svg '
sizes:
'': 33
xsmall: 16
small: 25
large: 51
refSize: 33
template: 'src/raw/icons/templates/stylesheet.hbs'
replace:
sprites:
src: 'src/raw/styles/_sprite.less'
dest: 'src/raw/styles/_sprite.less'
replacements: [
{
from: '../../raw/icons/',
to: '../icons/'
}
]
# optimize images if possible
imagemin:
out:
options:
optimizationLevel: 3,
files: [
expand: true,
cwd: 'out/images/',
src: ['**/*.{png,jpg,gif}'],
dest: 'out/images/'
]
src:
options:
optimizationLevel: 3,
files: [
expand: true,
cwd: 'src/raw/img/',
src: ['**/*.{png,jpg,jpeg,gif}'],
dest: 'src/raw/img/'
]
logo:
options:
optimizationLevel: 3,
files: [
expand: true,
cwd: 'src/documents/docs/logo/',
src: ['**/*.{svg,png,jpg,jpeg,gif}'],
dest: 'src/documents/docs/logo/'
]
# track changes in src dir and regenerate docpad
watch:
src:
files: ['<%= docpad.files %>']
tasks: [
'shell:docpad',
'postprocess'
]
out:
files: ['<%= docpad.out %>/**/*']
options:
livereload: true
less:
files: ['./src/raw/styles/**/*.*']
tasks: [
'postprocess'
]
# start server
connect:
server:
options:
port: 7777
hostname: '*'
base: '<%= docpad.out %>'
livereload: true
# open: true
# clean out dir
clean:
options:
force: true
out: ['<%= docpad.out %>']
copy:
main:
files: [
'out/vendor/animate.css/animate.min.css': 'bower_components/animate.css/animate.min.css',
'out/vendor/jquery.scrollTo/jquery.scrollTo.min.js': 'bower_components/jquery.scrollTo/jquery.scrollTo.min.js',
'out/vendor/jquery.localScroll/jquery.localScroll.min.js': 'bower_components/jquery.localScroll/jquery.localScroll.min.js',
'out/vendor/bowser/bowser.min.js': 'bower_components/bowser/bowser.min.js',
'out/vendor/SelectOrDie/selectordie.min.js': 'bower_components/SelectOrDie/_src/selectordie.min.js',
'out/vendor/SelectOrDie/selectordie.css': 'bower_components/SelectOrDie/_src/selectordie.css',
'out/vendor/alfablur/StackBlur.js': 'src/documents/scripts/StackBlur.js',
'out/vendor/alfablur/alfablur.js': 'src/documents/scripts/alfablur.js',
{
cwd: 'bower_components/jqgrid',
src: '**/*',
dest: 'out/vendor/jqgrid',
expand: true
}
]
manan:
files: [
'../BrCustomer/BrCustomerSite/Content/css/bossrevolution.css': 'out/styles/bossrevolution.css'
'../BrCustomer/BrCustomerSite/Content/css/bossrevolution.css.map': 'out/styles/bossrevolution.css.map'
]
# generate development
shell:
docpad:
options:
stdout: true
async: false
command: 'docpad generate --env static'
docpadrun:
options:
stdout: true
async: true
command: 'docpad run'
deploy:
options:
stdout: true
async: false
command: 'docpad deploy-ghpages --env static'
# measures the time each task takes
require('time-grunt')(grunt);
# Build the available Grunt tasks.
grunt.loadNpmTasks 'grunt-shell-spawn'
grunt.loadNpmTasks 'grunt-contrib-uglify'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-contrib-connect'
grunt.loadNpmTasks 'grunt-contrib-clean'
grunt.loadNpmTasks 'grunt-contrib-concat'
grunt.loadNpmTasks 'grunt-contrib-less'
grunt.loadNpmTasks 'grunt-contrib-imagemin'
grunt.loadNpmTasks 'grunt-contrib-copy'
grunt.loadNpmTasks 'grunt-autoprefixer'
grunt.loadNpmTasks 'grunt-newer'
grunt.loadNpmTasks 'grunt-svg2png'
grunt.loadNpmTasks 'grunt-svgstore'
grunt.loadNpmTasks 'grunt-svg2string'
grunt.loadNpmTasks 'grunt-dr-svg-sprites'
grunt.loadNpmTasks 'grunt-text-replace'
grunt.loadNpmTasks 'grunt-modernizr'
# Register our Grunt tasks.
grunt.registerTask 'makesprites', ['svgstore', 'svg2string', 'replace:sprites']
grunt.registerTask 'optimizeimg', ['svg2png:src', 'newer:imagemin:src']
grunt.registerTask 'preprocess', ['makesprites', 'optimizeimg']
grunt.registerTask 'prepare', ['copy:main', 'concat:bootstrap', 'uglify', 'modernizr:dist']
grunt.registerTask 'postprocess', ['less', 'autoprefixer:bossout']
grunt.registerTask 'generate', ['clean:out', 'shell:docpad', 'prepare', 'postprocess']
grunt.registerTask 'server', ['connect', 'watch:src', 'watch:out']
grunt.registerTask 'run2', ['generate', 'server']
grunt.registerTask 'run', ['shell:docpadrun', 'prepare', 'postprocess', 'watch:less']
grunt.registerTask 'development', ['prepare', 'postprocess', 'watch:less']
grunt.registerTask 'production', ['prepare', 'postprocess', 'copy:manan']
grunt.registerTask 'deploy', ['clean:out', 'prepare', 'postprocess', 'shell:deploy']
grunt.registerTask 'default', ['run']