hexo-yam/index.js

66 lines
1.9 KiB
JavaScript
Raw Normal View History

2016-05-26 11:09:41 +00:00
/* global hexo */
if (hexo.config.neat_enable === true) {
// HTML minifier
hexo.config.neat_html = Object.assign({
enable: true,
2018-10-25 09:45:26 +00:00
logger: false,
exclude: [],
collapseBooleanAttributes: true,
collapseWhitespace: true,
removeComments: true,
removeEmptyAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
minifyJS: true,
minifyCSS: true
}, hexo.config.neat_html)
2016-05-26 11:09:41 +00:00
// CSS minifier
hexo.config.neat_css = Object.assign({
enable: true,
2018-10-25 09:45:26 +00:00
logger: false,
2019-04-23 04:01:04 +00:00
exclude: ['*.min.css'],
level: 2
}, hexo.config.neat_css)
2016-05-26 11:09:41 +00:00
// Javascript minifier
hexo.config.neat_js = Object.assign({
enable: true,
2018-10-25 09:45:26 +00:00
logger: false,
2019-04-23 04:01:04 +00:00
exclude: ['*.min.js'],
compress: {},
2019-04-23 04:01:04 +00:00
mangle: true,
output: {}
}, hexo.config.neat_js)
2016-05-26 11:09:41 +00:00
2019-04-23 07:59:35 +00:00
// SVG minifier
hexo.config.neat_svg = Object.assign({
enable: true,
logger: false,
2019-05-02 06:25:43 +00:00
include: ['*.svg', '!*.min.svg'],
2019-05-21 04:15:18 +00:00
plugins: []
2019-04-23 07:59:35 +00:00
}, hexo.config.neat_svg)
// gzip compression
hexo.config.neat_gzip = Object.assign({
enable: true,
logger: false,
2019-05-02 06:25:43 +00:00
include: ['*.html', '*.css', '*.js', '*.txt', '*.ttf', '*.atom', '*.stl', '*.xml', '*.svg', '*.eot', '*.json']
}, hexo.config.neat_gzip)
2016-05-26 11:09:41 +00:00
// brotli compression
hexo.config.neat_brotli = Object.assign({
enable: true,
logger: false,
2019-05-02 06:25:43 +00:00
include: ['*.html', '*.css', '*.js', '*.txt', '*.ttf', '*.atom', '*.stl', '*.xml', '*.svg', '*.eot', '*.json']
}, hexo.config.neat_brotli)
2018-09-30 07:30:32 +00:00
const filter = require('./lib/filter')
hexo.extend.filter.register('after_render:html', filter.logicHtml)
hexo.extend.filter.register('after_render:css', filter.logicCss)
hexo.extend.filter.register('after_render:js', filter.logicJs)
2019-04-23 07:59:35 +00:00
hexo.extend.filter.register('after_generate', filter.logicSvg)
hexo.extend.filter.register('after_generate', filter.logicGzip)
hexo.extend.filter.register('after_generate', filter.logicBrotli)
}