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