-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
77 lines (66 loc) · 1.79 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
module.exports = (grunt) => {
// Load dependencies.
const path = require('path');
// Configure tasks.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
secret: grunt.file.readJSON('secret.json'),
sftp: {
production: {
files: {
'./': grunt.file.expand(['_site/**'])
},
options: {
path: '<%= secret.production.path %>',
host: '<%= secret.production.host %>',
username: '<%= secret.production.username %>',
password: '<%= secret.production.password %>',
port: '<%= secret.production.port %>',
showProgress: true,
createDirectories: true,
srcBasePath: '_site/'
}
}
}
});
// Load tasks.
require('load-grunt-tasks')(grunt);
// Register tasks.
grunt.registerTask('dev', 'Build and serve the Jekyll project', function () {
// Make asynchronous.
const done = this.async();
// Run the `serve` Jekyll command.
grunt.util.spawn({
cmd: '~/.rbenv/shims/bundle',
args: [
'exec', 'jekyll', 'serve',
'--config', '_config.development.yml'
],
opts: {
stdio: 'inherit',
shell: true
}
}, () => done());
});
grunt.registerTask('dist', 'Build the Jekyll project', function () {
// Make asynchronous.
const done = this.async();
// Run the `build` Jekyll command.
grunt.util.spawn({
cmd: '~/.rbenv/shims/bundle',
args: [
'exec', 'jekyll', 'build',
'--config', '_config.production.yml'
],
opts: {
stdio: 'inherit',
shell: true
}
}, () => done());
});
grunt.registerTask('deploy', [
'dist',
'sftp:production'
]);
grunt.registerTask('default', ['dev']);
};