This repository has been archived by the owner on Nov 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Gruntfile.js
109 lines (91 loc) · 2.86 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
'use strict';
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// shell commands for use in Grunt tasks
shell: {
jekyllBuild: {
command: 'jekyll build'
},
jekyllServe: {
command: function(host, port) {
return 'jekyll serve --detach --host=' + host + ' --port=' + port;
}
},
jekyllDev: {
command: function(host, port) {
return 'jekyll serve --host=' + host + ' --port=' + port;
}
},
nodeSass: {
command: function() {
return 'node-sass -q --source-map true --source-map-contents true --output /app/_site/css/ /app/_sass/main.scss'
}
}
},
concurrent: {
serve: [
'sass',
'watch',
'shell:jekyllDev:0.0.0.0:4000'
],
options: {
logConcurrentOutput: true
}
},
watch: {
sass: {
files: ['_sass/**/*.scss'],
tasks: ['sass']
}
},
copy: {
main: {
files: [{
expand: true,
cwd: 'node_modules/bootstrap-sass/assets/javascripts/',
src: ['bootstrap.min.js', ],
dest: '_site/js/'
}, {
expand: true,
cwd: 'node_modules/bootstrap-sass/assets/fonts/',
src: ['bootstrap/**'],
dest: '_site/fonts/'
}, {
expand: true,
cwd: 'node_modules/jquery/dist/',
src: ['jquery.min.js'],
dest: '_site/js/'
}]
}
}
});
grunt.registerTask('dev', 'concurrent:serve');
grunt.registerTask('serve', function() {
var host = grunt.option('host');
var port = grunt.option('port');
if(!host) {
host = '0.0.0.0';
}
if(!port) {
port = '4000';
}
grunt.task.run('build', 'shell:jekyllServe:' + host + ':' + port);
});
grunt.registerTask('build', [
'makeconfig',
'shell:jekyllBuild',
'copy',
'shell:nodeSass',
]);
grunt.registerTask('makeconfig', 'Creates a _config.yml file from the config template', function() {
var YAML = require('yamljs');
var config = YAML.load('_config.template.yml');
var url = grunt.option('url');
if(url) {
config.url = url;
}
grunt.file.write('_config.yml', YAML.stringify(config));
});
};