mirror of https://github.com/curbengh/hexo-yam
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
|
/* 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,
|
||
|
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,
|
||
|
exclude: ['*.min.css']
|
||
|
}, hexo.config.neat_css);
|
||
|
|
||
|
// Js minifier
|
||
|
hexo.config.neat_js = assign({
|
||
|
enable: true,
|
||
|
mangle: true,
|
||
|
output: {},
|
||
|
compress: {},
|
||
|
exclude: ['*.min.js']
|
||
|
}, hexo.config.neat_js, {
|
||
|
fromString: true
|
||
|
});
|
||
|
|
||
|
|
||
|
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);
|
||
|
}
|
||
|
//}
|