-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
91 lines (79 loc) · 1.91 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
module.exports = function(grunt) {
// Project configuration
grunt.initConfig({
meta: {
styles: [
'sass/**/*.scss',
]
},
// Compile Sass files to CSS
compass: {
options: {
require: 'compass-inuit',
sassDir: 'sass'
},
debug: {
options: {
cssDir: 'debug',
// For source maps
debugInfo: true,
outputStyle: 'expanded'
}
},
build: {
options: {
cssDir: 'build'
}
}
},
// Clean target directories
clean: {
debug: ['debug'],
buildTemp: [
'build/main.css',
'build/style.css',
'build/app.js'
],
all: ['debug', 'build']
},
// Run Jekyll commands
jekyll: {
server: {
server : true,
// Add the --watch flag, i.e. rebuild on file changes
watch: true
},
build: {
server: false
}
}
});
// Load tasks from plugins
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-jekyll');
// Compile JS & CSS, run watch to recompile on change
grunt.registerTask('debug', function() {
// Rebuild './debug'
grunt.task.run([
'clean:debug',
]);
// Watch for changes
grunt.task.run('watch');
});
// Alias to `grunt jekyll:server`
grunt.registerTask('server', 'jekyll:server');
// Run Jekyll build with environment set to production
grunt.registerTask('jekyll-production', function() {
grunt.log.writeln('Setting environment variable JEKYLL_ENV=production');
process.env.JEKYLL_ENV = 'production';
grunt.task.run('jekyll:build');
});
// Compile and minify JS & CSS, run Jekyll build for production
grunt.registerTask('build', [
'clean:all',
'clean:buildTemp',
'jekyll-production'
]);
grunt.registerTask('default', ['debug']);
};