mirror of https://github.com/curbengh/hexo-yam
fix: fix lint
This commit is contained in:
parent
77bf6c0224
commit
da397b4504
8
index.js
8
index.js
|
|
@ -119,16 +119,14 @@ if (hexo.config.minify.enable === true && !(hexo.config.minify.previewServer ===
|
|||
if (hexo.config.minify.css.enable === true) {
|
||||
if (hexo.config.minify.css.sourceMap) {
|
||||
hexo.extend.filter.register('after_generate', require('./lib/css').minifyCssWithMap, hexo.config.minify.js.priority)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
hexo.extend.filter.register('after_render:css', require('./lib/css').minifyCss, hexo.config.minify.css.priority)
|
||||
}
|
||||
}
|
||||
if (hexo.config.minify.js.enable === true) {
|
||||
if (hexo.config.minify.js.sourceMap) {
|
||||
hexo.extend.filter.register('after_generate', require('./lib/js').minifyJsWithMap, hexo.config.minify.js.priority)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
hexo.extend.filter.register('after_render:js', require('./lib/js').minifyJs, hexo.config.minify.js.priority)
|
||||
}
|
||||
}
|
||||
|
|
@ -153,4 +151,4 @@ if (hexo.config.minify.enable === true && !(hexo.config.minify.previewServer ===
|
|||
hexo.extend.filter.register('after_generate', zlib.zstdFn, hexo.config.minify.zstd.priority)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable space-before-function-paren */
|
||||
'use strict'
|
||||
const CleanCSS = require('clean-css')
|
||||
const { isMatch, match, logFn } = require('./tools')
|
||||
|
|
@ -51,7 +52,7 @@ function minifyCssWithMap() {
|
|||
try {
|
||||
const { base, ext, name } = parse(path)
|
||||
const { styles, sourceMap } = await cleanCSS.minify(assetTxt)
|
||||
if (verbose) logFn.call(this, assetTxt, result, path, 'css')
|
||||
if (verbose) logFn.call(this, assetTxt, styles, path, 'css')
|
||||
route.set(path, `${styles}\n/*# sourceMappingURL=${base}.map */`)
|
||||
const map = sourceMap.toJSON()
|
||||
map.sources = [`${name}.source${ext}`]
|
||||
|
|
@ -72,4 +73,4 @@ function minifyCssWithMap() {
|
|||
module.exports = {
|
||||
minifyCss,
|
||||
minifyCssWithMap
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
'use strict'
|
||||
module.exports = {
|
||||
... require('./html'),
|
||||
... require('./css'),
|
||||
... require('./js'),
|
||||
... require('./svg'),
|
||||
... require('./xml'),
|
||||
... require('./json'),
|
||||
... require('./zlib'),
|
||||
... require('./zstd')
|
||||
}
|
||||
...require('./html'),
|
||||
...require('./css'),
|
||||
...require('./js'),
|
||||
...require('./svg'),
|
||||
...require('./xml'),
|
||||
...require('./json'),
|
||||
...require('./zlib'),
|
||||
...require('./zstd')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable space-before-function-paren */
|
||||
'use strict'
|
||||
const { minify: htmlMinify } = require('html-minifier-terser')
|
||||
const { isMatch, logFn } = require('./tools')
|
||||
|
|
@ -29,4 +30,4 @@ async function minifyHtml(str, data) {
|
|||
|
||||
module.exports = {
|
||||
minifyHtml
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable space-before-function-paren */
|
||||
'use strict'
|
||||
const { minify: terserMinify } = require('terser')
|
||||
const { isMatch, match, logFn } = require('./tools')
|
||||
|
|
@ -68,7 +69,7 @@ function minifyJsWithMap() {
|
|||
url: `${base}.map`
|
||||
}
|
||||
const { code, map } = await terserMinify(assetTxt, { ...jsOptions })
|
||||
if (verbose) logFn.call(this, assetTxt, result, path, 'js')
|
||||
if (verbose) logFn.call(this, assetTxt, code, path, 'js')
|
||||
route.set(path, code)
|
||||
map.sources = [`${name}.source${ext}`]
|
||||
route.set(`${path}.map`, JSON.stringify(map))
|
||||
|
|
@ -85,4 +86,4 @@ function minifyJsWithMap() {
|
|||
module.exports = {
|
||||
minifyJs,
|
||||
minifyJsWithMap
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable space-before-function-paren */
|
||||
'use strict'
|
||||
const { match, logFn } = require('./tools')
|
||||
|
||||
|
|
@ -36,4 +37,4 @@ function minifyJson() {
|
|||
|
||||
module.exports = {
|
||||
minifyJson
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable space-before-function-paren */
|
||||
'use strict'
|
||||
const { optimize: svgOptimize } = require('svgo')
|
||||
const { match, logFn } = require('./tools')
|
||||
|
|
@ -45,4 +46,4 @@ function minifySvg() {
|
|||
|
||||
module.exports = {
|
||||
minifySvg
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable space-before-function-paren */
|
||||
'use strict'
|
||||
const micromatch = require('micromatch')
|
||||
|
||||
|
|
@ -69,4 +70,4 @@ module.exports = {
|
|||
isMatch,
|
||||
match,
|
||||
logFn
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable space-before-function-paren */
|
||||
'use strict'
|
||||
const { match, logFn } = require('./tools')
|
||||
|
||||
|
|
@ -38,4 +39,4 @@ async function minifyXml() {
|
|||
|
||||
module.exports = {
|
||||
minifyXml
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable space-before-function-paren */
|
||||
'use strict'
|
||||
const zlib = require('zlib')
|
||||
const { promisify } = require('util')
|
||||
|
|
@ -124,4 +125,4 @@ module.exports = {
|
|||
gzipFn,
|
||||
brotliFn,
|
||||
zstdFn
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue