forked from isobar-us/code-standards
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
105 lines (90 loc) · 2.53 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
/*global module:false*/
module.exports = function(grunt) {
'use strict';
// @todo: move to json file
var standards = {
ourLanguages : ['en', 'es'],
defaultFile : 'index',
defaultExt : '.html',
// change this to have the 'index' file be another language
defaultLanguage : 'en'
};
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
// clean up after the previous build
clean : {
build : (function(){
var arr = [];
// we iterate over the languages and create our list of output files
standards.ourLanguages.forEach(function(val){
arr.push(val + standards.defaultExt);
});
// add the default file to the list since it will be replaced by "copy"
arr.push(standards.defaultFile + standards.defaultExt);
return arr;
}())
},
// watch the file system for new changes
watch: {
css: {
files: ['scss/*.scss'],
tasks: ['compass']
},
html: {
files: ['sections/**/*.html', 'sections/**/*.html.md'],
tasks: ['default']
}
},
compass: {
dist: {
options: {
config: 'config.rb'
}
}
},
// combine our files into one file, language by language
assemble: {
options: {
layoutdir: './_layouts',
layout: 'main.hbs'
},
en: {
options : {
data : 'sections/en/build/data.json',
partials: ['sections/en/*.html']
},
files : {
'en.html' : ['sections/en/build/en.hbs']
}
},
es: {
options : {
data : 'sections/es/build/data.json',
partials: ['sections/es/*.html']
},
files : {
'es.html' : ['sections/es/build/es.hbs']
}
}
},
// copy the specified default language to the specified file
copy : {
realeaseLanguage : {
src : standards.defaultLanguage + standards.defaultExt,
dest : standards.defaultFile + standards.defaultExt
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('assemble');
// Default task.
grunt.registerTask('cleanup', ['clean']);
grunt.registerTask('default', ['clean', 'compass', 'assemble', 'copy']);
grunt.registerTask('watch', ['watch']);
};