2016-05-26 11:09:41 +00:00
|
|
|
/* global hexo */
|
|
|
|
var assign = require('object-assign');
|
|
|
|
|
|
|
|
//module.exports = function (hexo) {
|
|
|
|
if (true === hexo.config.neat_enable) {
|
|
|
|
// HTML minifier
|
|
|
|
hexo.config.neat_html = assign({
|
|
|
|
enable: true,
|
2018-06-29 08:08:47 +00:00
|
|
|
logger: true,
|
2016-05-26 11:09:41 +00:00
|
|
|
exclude: [],
|
|
|
|
ignoreCustomComments: [/^\s*more/],
|
|
|
|
removeComments: true,
|
|
|
|
removeCommentsFromCDATA: true,
|
|
|
|
collapseWhitespace: true,
|
|
|
|
collapseBooleanAttributes: true,
|
|
|
|
removeEmptyAttributes: true,
|
|
|
|
minifyJS: true,
|
|
|
|
minifyCSS: true,
|
|
|
|
}, hexo.config.neat_html);
|
|
|
|
|
|
|
|
// Css minifier
|
|
|
|
hexo.config.neat_css = assign({
|
|
|
|
enable: true,
|
2018-06-29 08:08:47 +00:00
|
|
|
logger: true,
|
2016-05-26 11:09:41 +00:00
|
|
|
exclude: ['*.min.css']
|
|
|
|
}, hexo.config.neat_css);
|
|
|
|
|
|
|
|
// Js minifier
|
|
|
|
hexo.config.neat_js = assign({
|
|
|
|
enable: true,
|
|
|
|
mangle: true,
|
2018-06-29 08:08:47 +00:00
|
|
|
logger: true,
|
2016-05-26 11:09:41 +00:00
|
|
|
output: {},
|
|
|
|
compress: {},
|
|
|
|
exclude: ['*.min.js']
|
2018-09-27 08:43:19 +00:00
|
|
|
}, hexo.config.neat_js);
|
2016-05-26 11:09:41 +00:00
|
|
|
|
2018-09-28 07:43:54 +00:00
|
|
|
// html, css, js compression
|
|
|
|
hexo.config.gzip = assign({
|
|
|
|
enable: true,
|
|
|
|
logger: true,
|
|
|
|
}, hexo.config.gzip);
|
2016-05-26 11:09:41 +00:00
|
|
|
|
|
|
|
var filter = require('./lib/filter');
|
|
|
|
hexo.extend.filter.register('after_render:html', filter.logic_html);
|
|
|
|
hexo.extend.filter.register('after_render:css', filter.logic_css);
|
|
|
|
hexo.extend.filter.register('after_render:js', filter.logic_js);
|
2018-09-28 07:52:22 +00:00
|
|
|
hexo.extend.filter.register('after_generate', filter.logic_gzip);
|
2016-05-26 11:09:41 +00:00
|
|
|
}
|
|
|
|
//}
|