This repository has been archived by the owner on Mar 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.js
470 lines (459 loc) · 10.9 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
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
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
// Generated on 2013-09-30 using generator-jekyllrb 0.4.0
// Directory reference:
// css: styles
// compass: styles/scss
// javascript: scripts
// images: images
// fonts: fonts
module.exports = function(grunt) {
'use strict';
// Show elapsed time after tasks run
require('time-grunt')(grunt);
// Load all Grunt tasks
require('load-grunt-tasks')(grunt);
grunt.initConfig({
// Configurable paths
yeoman: {
app: 'app',
dist: 'dist'
},
watch: {
compass: {
files: ['<%= yeoman.app %>/styles/scss/**/*.{scss,sass}'],
tasks: ['compass:server', 'autoprefixer:server']
},
autoprefixer: {
files: ['<%= yeoman.app %>/styles/**/*.css'],
tasks: ['copy:stageCss', 'autoprefixer:server']
},
jekyll: {
files: [
'<%= yeoman.app %>/**/*.{html,yml,md,mkd,markdown}',
'_config.yml',
'!<%= yeoman.app %>/_bower_components'
],
tasks: ['jekyll:server']
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'.jekyll/**/*.html',
'.tmp/styles/**/*.css',
'{.tmp,<%= yeoman.app %>}/<%= js %>/**/*.js',
'<%= yeoman.app %>/images/**/*.{gif,jpg,jpeg,png,svg,webp}'
]
}
},
connect: {
options: {
port: 9100,
livereload: 35729,
// change this to '0.0.0.0' to access the server from outside
hostname: 'localhost'
},
livereload: {
options: {
open: true,
base: [
'.tmp',
'.jekyll',
'<%= yeoman.app %>'
]
}
},
dist: {
options: {
open: true,
base: [
'<%= yeoman.dist %>'
]
}
},
test: {
options: {
base: [
'.tmp',
'.jekyll',
'test',
'<%= yeoman.app %>'
]
}
}
},
clean: {
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= yeoman.dist %>/*',
// Running Jekyll also cleans the target directory. Exclude any
// non-standard `keep_files` here (e.g., the generated files
// directory from Jekyll Picture Tag).
'!<%= yeoman.dist %>/.git*'
]
}]
},
server: [
'.tmp',
'.jekyll'
]
},
compass: {
options: {
// If you're using global Sass gems, require them here.
require: ['compass-normalize', 'breakpoint'],
bundleExec: true,
sassDir: '<%= yeoman.app %>/styles/scss',
cssDir: '.tmp/styles',
imagesDir: '<%= yeoman.app %>/images',
javascriptsDir: '<%= yeoman.app %>/scripts',
relativeAssets: false,
httpImagesPath: '/images',
httpGeneratedImagesPath: '/images/generated',
outputStyle: 'expanded',
raw: 'extensions_dir = "<%= yeoman.app %>/_bower_components"\n'
},
dist: {
options: {
generatedImagesDir: '<%= yeoman.dist %>/images/generated'
}
},
server: {
options: {
debugInfo: true,
generatedImagesDir: '.tmp/images/generated'
}
}
},
autoprefixer: {
options: {
browsers: ['last 2 versions']
},
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.dist %>/styles',
src: '**/*.css',
dest: '<%= yeoman.dist %>/styles'
}]
},
server: {
files: [{
expand: true,
cwd: '.tmp/styles',
src: '**/*.css',
dest: '.tmp/styles'
}]
}
},
jekyll: {
options: {
bundleExec: true,
config: '_config.yml,_config.build.yml',
src: '<%= yeoman.app %>'
},
dist: {
options: {
dest: '<%= yeoman.dist %>',
}
},
server: {
options: {
config: '_config.yml',
dest: '.jekyll'
}
},
check: {
options: {
doctor: true
}
}
},
// UseminPrepare will only scan a single page for usemin blocks. If you
// use usemin blocks that aren't in index.html, create a usemin manifest
// page (hackery!) and point this task there.
useminPrepare: {
options: {
dest: '<%= yeoman.dist %>'
},
html: '<%= yeoman.dist %>/index.html'
},
usemin: {
options: {
basedir: '<%= yeoman.dist %>',
dirs: ['<%= yeoman.dist %>/**/*']
},
html: ['<%= yeoman.dist %>/**/*.html'],
css: ['<%= yeoman.dist %>/styles/**/*.css']
},
htmlmin: {
dist: {
options: {
collapseWhitespace: true,
collapseBooleanAttributes: true,
removeAttributeQuotes: true,
removeRedundantAttributes: true
},
files: [{
expand: true,
cwd: '<%= yeoman.dist %>',
src: '**/*.html',
dest: '<%= yeoman.dist %>'
}]
}
},
// Usemin adds files to concat
concat: {},
// Usemin adds files to uglify
uglify: {},
// Usemin adds files to cssmin
cssmin: {
dist: {
options: {
check: 'gzip'
}
}
},
imagemin: {
dist: {
options: {
progressive: true
},
files: [{
expand: true,
cwd: '<%= yeoman.dist %>',
src: '**/*.{jpg,jpeg,png}',
dest: '<%= yeoman.dist %>'
}]
}
},
svgmin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.dist %>',
src: '**/*.svg',
dest: '<%= yeoman.dist %>'
}]
}
},
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
src: [
// Jekyll processes and moves HTML and text files
// Usemin moves CSS and javascript inside of Usemin blocks
// Copy moves asset files and directories
'images/**/*',
'fonts/**/*',
// Like Jekyll, exclude files & folders prefixed with an underscore
'!**/_*{,/**}',
// Explicitly add any files your site needs for distribution here
'_bower_components/jquery/jquery.js',
'favicon.ico',
'apple-touch*.png'
],
dest: '<%= yeoman.dist %>'
}]
},
// Copy CSS into .tmp directory for Autoprefixer processing
stageCss: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>/styles',
src: '**/*.css',
dest: '.tmp/styles'
}]
}
},
rev: {
options: {
length: 4
},
dist: {
files: {
src: [
'<%= yeoman.dist %>/scripts/**/*.js',
'<%= yeoman.dist %>/styles/**/*.css',
'<%= yeoman.dist %>/images/**/*.{gif,jpg,jpeg,png,svg,webp}',
'<%= yeoman.dist %>/fonts/**/*.{eot*,otf,svg,ttf,woff}'
]
}
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'<%= yeoman.app %>/scripts/**/*.js',
'test/spec/**/*.js',
'!<%= yeoman.app %>/scripts/vendor/**/*'
]
},
csscss: {
options: {
bundleExec: true,
minMatch: 2,
ignoreSassMixins: false,
compass: true,
colorize: true,
shorthand: false,
verbose: true
},
check: {
src: [
'.tmp/styles/**/*.css',
'<%= yeoman.app %>/styles/**/*.css'
]
}
},
csslint: {
options: {
csslintrc: '.csslintrc'
},
check: {
src: [
'.tmp/styles/**/*.css',
'<%= yeoman.app %>/styles/**/*.css'
]
}
},
concurrent: {
server: [
'compass:server',
'copy:stageCss',
'jekyll:server'
],
dist: [
'compass:dist',
'modernizr',
'copy:dist'
]
},
modernizr: {
'devFile': '<%= yeoman.app %>/_bower_components/modernizr/modernizr.js',
'outputFile': '<%= yeoman.app %>/_bower_components/modernizr/modernizr-custom.js',
'extra': {
'shiv': true,
'printshiv': false,
'load': false,
'mq': false,
'cssclasses': false
},
'extensibility': {
'addtest': false,
'prefixed': false,
'teststyles': false,
'testprops': false,
'testallprops': false,
'hasevents': false,
'prefixes': false,
'domprefixes': false
},
'uglify': false,
// Define any tests you want to implicitly include.
// 'tests' : [],
'parseFiles': true,
'files': ['<%= yeoman.app %>'],
'matchCommunityTests': true,
},
// TODO: fork grunt-favicons and use png2ico
favicons: {
options: {
html: 'dist/index.html',
HTMLPrefix: '',
appleTouchBackgroundColor: '#ffffff',
tileColor: '#ffffff'
},
icons: {
src: 'app/images/favicon.png',
dest: 'dist'
},
},
// TODO: convert shell command to use png2ico on npm
shell: {
png2ico: {
command: 'png2ico <%= yeoman.dist %>/favicon.ico <%= yeoman.app %>/images/favicon.16x16.png <%= yeoman.app %>/images/favicon.32x32.png --colors 16'
}
},
buildcontrol: {
options: {
dir: 'dist',
commit: true,
push: true,
message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
},
pages: {
options: {
remote: '[email protected]:rpowis/commune.git',
branch: 'gh-pages'
}
}
}
});
// Define Tasks
grunt.registerTask('server', function(target) {
if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']);
}
grunt.task.run([
'clean:server',
'concurrent:server',
'autoprefixer:server',
'connect:livereload',
'watch'
]);
});
// No real tests yet. Add your own.
grunt.registerTask('test', [
// 'clean:server',
// 'concurrent:test',
// 'connect:test'
]);
grunt.registerTask('check', [
'clean:server',
'jekyll:check',
'compass:dist',
'jshint:all',
'csscss:check',
'csslint:check'
]);
grunt.registerTask('build', [
'clean:dist',
// Jekyll cleans files from the target directory, so must run first
'jekyll:dist',
'concurrent:dist',
'useminPrepare',
'concat',
'autoprefixer:dist',
'cssmin',
'uglify',
'imagemin',
'svgmin',
'rev',
'usemin',
'favicons',
'shell',
'htmlmin'
]);
grunt.registerTask('deploy', [
'check',
'test',
'build',
'buildcontrol'
]);
grunt.registerTask('default', [
'check',
'test',
'build'
]);
};