-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
executable file
·175 lines (145 loc) · 3.53 KB
/
Gruntfile.js
File metadata and controls
executable file
·175 lines (145 loc) · 3.53 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
module.exports = function(grunt) {
// Show elapsed time after tasks run to visualize performance
require('time-grunt')(grunt);
// Load all Grunt tasks that are listed in package.json automagically
require('load-grunt-tasks')(grunt);
grunt.initConfig({
// Project configuration.
pkg: grunt.file.readJSON('package.json'),
// Shell commands for use in Grunt tasks
shell: {
jekyllBuild: {
command: 'bundle exec jekyll build'
},
jekyllServe: {
command: 'bundle exec jekyll serve'
}
},
// Sass (libsass) config
sass: {
options: {
sourceMap: true,
relativeAssets: false,
outputStyle: 'compressed',
sassDir: 'assets/scss',
cssDir: '_site/assets/css'
},
build: {
files: [{
expand: true,
cwd: 'assets/scss/',
src: ['*.scss'],
dest: '_site/assets/css',
ext: '.css'
}]
}
},
// SCSS lint
scsslint: {
allFiles: [
'assets/scss/*.scss',
'assets/scss/global/**/*.scss',
'assets/scss/local/**/*.scss'
],
options: {
colorizeOutput: true,
config: '.scss-lint.yml',
exclude: [
'assets/scss/global/utilities/_normalize.scss',
'assets/scss/global/utilities/_utility-values.scss'
],
reporterOutput: 'scss-lint-report.xml'
}
},
// Copy content of fonts directory
copy: {
main: {
files: [{
expand: true,
cwd: 'assets/fonts/',
src: ['**'],
dest: '_site/assets/fonts'
}]
}
},
// Publishing docs to GitHub Pages
buildcontrol: {
options: {
dir: '_site',
commit: true,
push: true,
message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
},
pages: {
options: {
remote: 'git@github.com:fac/origin.git',
branch: 'gh-pages'
}
}
},
// Live reload and sync up browsing across browsers
browserSync: {
dev: {
bsFiles: {
src : [
'_site/*.*',
'_site/**/*.*'
]
},
options: {
port: 9001,
proxy: "http://0.0.0.0:8001/origin/"
}
}
},
// Run tasks in parallel
concurrent: {
serve: [
'watch',
'shell:jekyllServe'
],
options: {
logConcurrentOutput: true
}
},
// Watch for files to change and run tasks when they do
watch: {
scsslint: {
files: [
'assets/scss/*.scss',
'assets/scss/global/**/*.scss',
'assets/scss/local/**/*.scss'
],
tasks: ['scsslint']
},
sass: {
files: [
'assets/scss/*.scss',
'assets/scss/**/*.scss',
'assets/scss/**/**/*.scss'
],
tasks: ['sass']
}
}
});
// Task for build and serve documentation locally
grunt.registerTask('serve', [
'copy',
'sass',
'concurrent:serve'
]);
// Task for running Browsersync
grunt.registerTask('sync', [
'browserSync'
]);
// Task to only build documentation locally
grunt.registerTask('build', [
'copy',
'sass',
'shell:jekyllBuild'
]);
// Register build and serve task as the default
grunt.registerTask('default', 'serve');
// Task for publishing documentation to GitHub Pages
grunt.registerTask('publish', ['shell:jekyllBuild', 'buildcontrol:pages']);
};