fix: set default config

This commit is contained in:
MDLeom 2020-09-05 11:41:22 +00:00
parent 37ba1d9a2b
commit c57e227efd
No known key found for this signature in database
GPG Key ID: 06C236E63CBC68AA
1 changed files with 81 additions and 73 deletions

View File

@ -2,8 +2,10 @@
'use strict'
hexo.config.minify = Object.assign({
enable: true,
html: {
enable: true
}, hexo.config.minify)
hexo.config.minify.html = Object.assign({
enable: true,
priority: 10,
verbose: false,
@ -19,16 +21,18 @@ hexo.config.minify = Object.assign({
minifyJS: true,
minifyCSS: true,
globOptions: { basename: true }
},
css: {
}, hexo.config.minify.html)
hexo.config.minify.css = Object.assign({
enable: true,
priority: 10,
verbose: false,
exclude: ['*.min.css'],
level: 2,
globOptions: { basename: true }
},
js: {
}, hexo.config.minify.css)
hexo.config.minify.js = Object.assign({
enable: true,
priority: 10,
verbose: false,
@ -37,45 +41,49 @@ hexo.config.minify = Object.assign({
mangle: true,
output: {},
globOptions: { basename: true }
},
svg: {
}, hexo.config.minify.js)
hexo.config.minify.svg = Object.assign({
enable: true,
priority: 10,
verbose: false,
include: ['*.svg', '!*.min.svg'],
plugins: [],
globOptions: { basename: true }
},
gzip: {
}, hexo.config.minify.svg)
hexo.config.minify.gzip = Object.assign({
enable: true,
priority: 10,
verbose: false,
include: ['*.html', '*.css', '*.js', '*.txt', '*.ttf', '*.atom', '*.stl', '*.xml', '*.svg', '*.eot', '*.json'],
globOptions: { basename: true }
},
brotli: {
}, hexo.config.minify.gzip)
hexo.config.minify.brotli = Object.assign({
enable: true,
priority: 10,
verbose: false,
include: ['*.html', '*.css', '*.js', '*.txt', '*.ttf', '*.atom', '*.stl', '*.xml', '*.svg', '*.eot', '*.json'],
globOptions: { basename: true }
},
xml: {
}, hexo.config.minify.brotli)
hexo.config.minify.xml = Object.assign({
enable: false,
priority: 10,
verbose: false,
include: ['*.xml', '!*.min.xml'],
removeComments: true,
globOptions: { basename: true }
},
json: {
}, hexo.config.minify.xml)
hexo.config.minify.json = Object.assign({
enable: false,
priority: 10,
verbose: false,
include: ['*.json', '!*.min.json'],
globOptions: { basename: true }
}
}, hexo.config.minify)
}, hexo.config.minify.json)
if (hexo.config.minify.enable === true) {
const filter = require('./lib/filter')