forked from incompl/learnlayout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
71 lines (60 loc) · 1.32 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
/* jshint node:true, camelcase:false */
var fs = require('fs');
module.exports = function(grunt) {
// params
var lang = grunt.option('lang') || 'en';
var ftpDir = 'learnlayout';
if (lang !== 'en') {
ftpDir += '_' + lang;
}
// test for valid language
try {
fs.statSync('translations/' + lang + '.yaml');
}
catch (e) {
grunt.fail.fatal('Invalid language "' + lang + '"');
}
grunt.log.write('Language: ' + lang);
// config
grunt.initConfig({
jekyll: {
options: {
src: 'templates',
plugins: '_plugins',
dest: '_site',
pygments: true,
raw: 'lang: ' + lang
},
build: {},
serve: {
options: {
watch: true,
serve: true
}
}
},
'ftp-deploy': {
build: {
auth: {
host: 'startcontinue.com',
port: 21
},
src: '_site',
dest: ftpDir,
exclusions: [
'Gruntfile.js',
'package.json',
'.git*',
'node_modules'
]
}
}
});
// plugins
grunt.loadNpmTasks('grunt-jekyll');
grunt.loadNpmTasks('grunt-ftp-deploy');
// tasks
grunt.registerTask('default', ['jekyll:build']);
grunt.registerTask('serve', ['jekyll:serve']);
grunt.registerTask('deploy', ['default', 'ftp-deploy']);
};