mirror of https://github.com/curbengh/hexo-yam
style: rename logic* to minify* or *Fn
This commit is contained in:
parent
b5639aba85
commit
7085b15d10
12
index.js
12
index.js
|
@ -64,10 +64,10 @@ hexo.config.minify.brotli = Object.assign({
|
|||
|
||||
if (hexo.config.minify.enable === true) {
|
||||
const filter = require('./lib/filter')
|
||||
hexo.extend.filter.register('after_render:html', filter.logicHtml)
|
||||
hexo.extend.filter.register('after_render:css', filter.logicCss)
|
||||
hexo.extend.filter.register('after_render:js', filter.logicJs)
|
||||
hexo.extend.filter.register('after_generate', filter.logicSvg)
|
||||
hexo.extend.filter.register('after_generate', filter.logicGzip)
|
||||
hexo.extend.filter.register('after_generate', filter.logicBrotli)
|
||||
hexo.extend.filter.register('after_render:html', filter.minifyHtml)
|
||||
hexo.extend.filter.register('after_render:css', filter.minifyCss)
|
||||
hexo.extend.filter.register('after_render:js', filter.minifyJs)
|
||||
hexo.extend.filter.register('after_generate', filter.minifySvg)
|
||||
hexo.extend.filter.register('after_generate', filter.gzipFn)
|
||||
hexo.extend.filter.register('after_generate', filter.brotliFn)
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ function verbose (original, minified, path, ext) {
|
|||
log.log(`${ext}: ${path} [${saved}% saved]`)
|
||||
}
|
||||
|
||||
function logicHtml (str, data) {
|
||||
function minifyHtml (str, data) {
|
||||
const hexo = this
|
||||
const options = hexo.config.minify.html
|
||||
// Return if disabled.
|
||||
|
@ -45,7 +45,7 @@ function logicHtml (str, data) {
|
|||
return result
|
||||
}
|
||||
|
||||
function logicCss (str, data) {
|
||||
function minifyCss (str, data) {
|
||||
const hexo = this
|
||||
const options = hexo.config.minify.css
|
||||
if (options.enable === false) return
|
||||
|
@ -69,7 +69,7 @@ function logicCss (str, data) {
|
|||
})
|
||||
}
|
||||
|
||||
function logicJs (str, data) {
|
||||
function minifyJs (str, data) {
|
||||
const hexo = this
|
||||
const options = hexo.config.minify.js
|
||||
if (options.enable === false) return
|
||||
|
@ -97,7 +97,7 @@ function logicJs (str, data) {
|
|||
return result.code
|
||||
}
|
||||
|
||||
function logicSvg () {
|
||||
function minifySvg () {
|
||||
const hexo = this
|
||||
const options = hexo.config.minify.svg
|
||||
// Return if disabled.
|
||||
|
@ -136,7 +136,7 @@ function logicSvg () {
|
|||
}))
|
||||
}
|
||||
|
||||
function logicGzip () {
|
||||
function gzipFn () {
|
||||
const hexo = this
|
||||
const options = hexo.config.minify.gzip
|
||||
// Return if disabled.
|
||||
|
@ -179,7 +179,7 @@ function logicGzip () {
|
|||
}))
|
||||
}
|
||||
|
||||
function logicBrotli () {
|
||||
function brotliFn () {
|
||||
const hexo = this
|
||||
const options = hexo.config.minify.brotli
|
||||
// Return if disabled.
|
||||
|
@ -225,10 +225,10 @@ function logicBrotli () {
|
|||
}
|
||||
|
||||
module.exports = {
|
||||
logicHtml: logicHtml,
|
||||
logicCss: logicCss,
|
||||
logicJs: logicJs,
|
||||
logicSvg: logicSvg,
|
||||
logicGzip: logicGzip,
|
||||
logicBrotli: logicBrotli
|
||||
minifyHtml: minifyHtml,
|
||||
minifyCss: minifyCss,
|
||||
minifyJs: minifyJs,
|
||||
minifySvg: minifySvg,
|
||||
gzipFn: gzipFn,
|
||||
brotliFn: brotliFn
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue