style: rearrange and give more neat_js config examples

This commit is contained in:
weyusi 2019-04-23 17:46:56 +09:30
parent 55b48a76aa
commit 374c16575b
3 changed files with 10 additions and 9 deletions

View File

@ -70,9 +70,10 @@ neat_js:
- **enable** - Enable the plugin. Defaults to `true`.
- **logger** - Verbose output. Defaults to `false`.
- **exclude** - Exclude files. Support wildcard pattern.
- **mangle** - Mangle file names. Defaults to `true`.
- **output** - Output options.
- **compress** - Compress options.
- **mangle** - Mangle variable names. Defaults to `true`. Pass an object to specify [mangle options](https://github.com/terser-js/terser#mangle-options).
- **output** - Output options.
- To retain comments, `output: {comments: true}`.
For more options, see [Terser](https://github.com/terser-js/terser).

View File

@ -15,7 +15,7 @@ if (hexo.config.neat_enable === true) {
minifyCSS: true
}, hexo.config.neat_html)
// Css minifier
// CSS minifier
hexo.config.neat_css = Object.assign({
enable: true,
logger: false,
@ -23,14 +23,14 @@ if (hexo.config.neat_enable === true) {
level: 2
}, hexo.config.neat_css)
// Js minifier
// Javascript minifier
hexo.config.neat_js = Object.assign({
enable: true,
logger: false,
exclude: ['*.min.js'],
compress: {},
mangle: true,
output: {},
compress: {}
output: {}
}, hexo.config.neat_js)
// SVG minifier

View File

@ -1,12 +1,12 @@
/* global hexo */
'use strict'
const Htmlminifier = require('html-minifier').minify
const CleanCSS = require('clean-css')
const Terser = require('terser')
const Htmlminifier = require('html-minifier').minify
const nanomatch = require('nanomatch')
const svgo = require('svgo')
const zlib = require('zlib')
const br = require('iltorb')
const svgo = require('svgo')
const nanomatch = require('nanomatch')
function logicHtml (str, data) {
const hexo = this