4 hexo.config.minify = Object.assign({
8 hexo.config.minify.html = Object.assign({
13 collapseBooleanAttributes: true,
14 collapseWhitespace: true,
15 // Ignore '<!-- more -->' https://hexo.io/docs/tag-plugins#Post-Excerpt
16 ignoreCustomComments: [/^\s*more/],
18 removeEmptyAttributes: true,
19 removeScriptTypeAttributes: true,
20 removeStyleLinkTypeAttributes: true,
23 globOptions: { basename: true }
24 }, hexo.config.minify.html)
26 hexo.config.minify.css = Object.assign({
30 exclude: ['*.min.css'],
32 globOptions: { basename: true }
33 }, hexo.config.minify.css)
35 hexo.config.minify.js = Object.assign({
39 exclude: ['*.min.js'],
43 globOptions: { basename: true }
44 }, hexo.config.minify.js)
46 hexo.config.minify.svg = Object.assign({
50 include: ['*.svg', '!*.min.svg'],
52 globOptions: { basename: true }
53 }, hexo.config.minify.svg)
55 hexo.config.minify.gzip = Object.assign({
59 include: ['*.html', '*.css', '*.js', '*.txt', '*.ttf', '*.atom', '*.stl', '*.xml', '*.svg', '*.eot', '*.json'],
60 globOptions: { basename: true }
61 }, hexo.config.minify.gzip)
63 hexo.config.minify.brotli = Object.assign({
67 include: ['*.html', '*.css', '*.js', '*.txt', '*.ttf', '*.atom', '*.stl', '*.xml', '*.svg', '*.eot', '*.json'],
68 globOptions: { basename: true }
69 }, hexo.config.minify.brotli)
71 hexo.config.minify.xml = Object.assign({
75 include: ['*.xml', '!*.min.xml'],
77 globOptions: { basename: true }
78 }, hexo.config.minify.xml)
80 hexo.config.minify.json = Object.assign({
84 include: ['*.json', '!*.min.json'],
85 globOptions: { basename: true }
86 }, hexo.config.minify.json)
88 if (hexo.config.minify.enable === true) {
89 const filter = require('./lib/filter')
90 hexo.extend.filter.register('after_render:html', filter.minifyHtml, hexo.config.minify.html.priority)
91 hexo.extend.filter.register('after_render:css', filter.minifyCss, hexo.config.minify.css.priority)
92 hexo.extend.filter.register('after_render:js', filter.minifyJs, hexo.config.minify.js.priority)
93 hexo.extend.filter.register('after_generate', filter.minifySvg, hexo.config.minify.svg.priority)
94 hexo.extend.filter.register('after_generate', filter.gzipFn, hexo.config.minify.gzip.priority)
95 hexo.extend.filter.register('after_generate', filter.brotliFn, hexo.config.minify.brotli.priority)
96 hexo.extend.filter.register('after_generate', filter.minifyXml, hexo.config.minify.xml.priority)
97 hexo.extend.filter.register('after_generate', filter.minifyJson, hexo.config.minify.json.priority)