mirror of https://github.com/curbengh/hexo-yam
fix: fix lint
This commit is contained in:
parent
77bf6c0224
commit
da397b4504
6
index.js
6
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.enable === true) {
|
||||||
if (hexo.config.minify.css.sourceMap) {
|
if (hexo.config.minify.css.sourceMap) {
|
||||||
hexo.extend.filter.register('after_generate', require('./lib/css').minifyCssWithMap, hexo.config.minify.js.priority)
|
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)
|
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.enable === true) {
|
||||||
if (hexo.config.minify.js.sourceMap) {
|
if (hexo.config.minify.js.sourceMap) {
|
||||||
hexo.extend.filter.register('after_generate', require('./lib/js').minifyJsWithMap, hexo.config.minify.js.priority)
|
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)
|
hexo.extend.filter.register('after_render:js', require('./lib/js').minifyJs, hexo.config.minify.js.priority)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable space-before-function-paren */
|
||||||
'use strict'
|
'use strict'
|
||||||
const CleanCSS = require('clean-css')
|
const CleanCSS = require('clean-css')
|
||||||
const { isMatch, match, logFn } = require('./tools')
|
const { isMatch, match, logFn } = require('./tools')
|
||||||
|
|
@ -51,7 +52,7 @@ function minifyCssWithMap() {
|
||||||
try {
|
try {
|
||||||
const { base, ext, name } = parse(path)
|
const { base, ext, name } = parse(path)
|
||||||
const { styles, sourceMap } = await cleanCSS.minify(assetTxt)
|
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 */`)
|
route.set(path, `${styles}\n/*# sourceMappingURL=${base}.map */`)
|
||||||
const map = sourceMap.toJSON()
|
const map = sourceMap.toJSON()
|
||||||
map.sources = [`${name}.source${ext}`]
|
map.sources = [`${name}.source${ext}`]
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable space-before-function-paren */
|
||||||
'use strict'
|
'use strict'
|
||||||
const { minify: htmlMinify } = require('html-minifier-terser')
|
const { minify: htmlMinify } = require('html-minifier-terser')
|
||||||
const { isMatch, logFn } = require('./tools')
|
const { isMatch, logFn } = require('./tools')
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable space-before-function-paren */
|
||||||
'use strict'
|
'use strict'
|
||||||
const { minify: terserMinify } = require('terser')
|
const { minify: terserMinify } = require('terser')
|
||||||
const { isMatch, match, logFn } = require('./tools')
|
const { isMatch, match, logFn } = require('./tools')
|
||||||
|
|
@ -68,7 +69,7 @@ function minifyJsWithMap() {
|
||||||
url: `${base}.map`
|
url: `${base}.map`
|
||||||
}
|
}
|
||||||
const { code, map } = await terserMinify(assetTxt, { ...jsOptions })
|
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)
|
route.set(path, code)
|
||||||
map.sources = [`${name}.source${ext}`]
|
map.sources = [`${name}.source${ext}`]
|
||||||
route.set(`${path}.map`, JSON.stringify(map))
|
route.set(`${path}.map`, JSON.stringify(map))
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable space-before-function-paren */
|
||||||
'use strict'
|
'use strict'
|
||||||
const { match, logFn } = require('./tools')
|
const { match, logFn } = require('./tools')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable space-before-function-paren */
|
||||||
'use strict'
|
'use strict'
|
||||||
const { optimize: svgOptimize } = require('svgo')
|
const { optimize: svgOptimize } = require('svgo')
|
||||||
const { match, logFn } = require('./tools')
|
const { match, logFn } = require('./tools')
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable space-before-function-paren */
|
||||||
'use strict'
|
'use strict'
|
||||||
const micromatch = require('micromatch')
|
const micromatch = require('micromatch')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable space-before-function-paren */
|
||||||
'use strict'
|
'use strict'
|
||||||
const { match, logFn } = require('./tools')
|
const { match, logFn } = require('./tools')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable space-before-function-paren */
|
||||||
'use strict'
|
'use strict'
|
||||||
const zlib = require('zlib')
|
const zlib = require('zlib')
|
||||||
const { promisify } = require('util')
|
const { promisify } = require('util')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue