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`. - **enable** - Enable the plugin. Defaults to `true`.
- **logger** - Verbose output. Defaults to `false`. - **logger** - Verbose output. Defaults to `false`.
- **exclude** - Exclude files. Support wildcard pattern. - **exclude** - Exclude files. Support wildcard pattern.
- **mangle** - Mangle file names. Defaults to `true`.
- **output** - Output options.
- **compress** - Compress 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). 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 minifyCSS: true
}, hexo.config.neat_html) }, hexo.config.neat_html)
// Css minifier // CSS minifier
hexo.config.neat_css = Object.assign({ hexo.config.neat_css = Object.assign({
enable: true, enable: true,
logger: false, logger: false,
@ -23,14 +23,14 @@ if (hexo.config.neat_enable === true) {
level: 2 level: 2
}, hexo.config.neat_css) }, hexo.config.neat_css)
// Js minifier // Javascript minifier
hexo.config.neat_js = Object.assign({ hexo.config.neat_js = Object.assign({
enable: true, enable: true,
logger: false, logger: false,
exclude: ['*.min.js'], exclude: ['*.min.js'],
compress: {},
mangle: true, mangle: true,
output: {}, output: {}
compress: {}
}, hexo.config.neat_js) }, hexo.config.neat_js)
// SVG minifier // SVG minifier

View File

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