-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
47 lines (43 loc) · 1.11 KB
/
index.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
/* global hexo */
'use strict';
var config = hexo.config.filter_optimize = Object.assign({
enable : true,
remove_comments: false,
css : {
minify : true,
bundle : true,
delivery: true,
inlines : ['css/main.css'],
excludes: []
},
js: {
minify : true,
bundle : true,
excludes: []
},
image: {
minify: true,
interlaced: false,
multipass: false,
optimizationLevel: 2,
pngquant: false,
progressive: false
}
}, hexo.config.filter_optimize);
if (process.env.NODE_ENV !== 'development' && config.enable) {
const { filter, css, js, image } = require('./lib/index');
const priority = parseInt(config.priority, 10) || 10;
// Enable one of the optimizations.
if (config.css.bundle || config.js.bundle) {
hexo.extend.filter.register('after_generate', filter, priority);
}
if (config.css.minify) {
hexo.extend.filter.register('after_render:css', css);
}
if (config.js.minify) {
hexo.extend.filter.register('after_render:js', js);
}
if (config.image.minify) {
//hexo.extend.filter.register('after_generate', image);
}
}