mirror of https://github.com/curbengh/hexo-yam
refactor: destructure object
This commit is contained in:
parent
7085b15d10
commit
fd474580ce
|
@ -28,9 +28,8 @@ function minifyHtml (str, data) {
|
|||
// Return if disabled.
|
||||
if (options.enable === false) return
|
||||
|
||||
const path = data.path
|
||||
const exclude = options.exclude
|
||||
const globOptions = options.globOptions
|
||||
const { path } = data
|
||||
const { exclude, globOptions } = options
|
||||
|
||||
let excludeString = exclude || ''
|
||||
if (Array.isArray(exclude)) excludeString = exclude.join('')
|
||||
|
@ -50,9 +49,8 @@ function minifyCss (str, data) {
|
|||
const options = hexo.config.minify.css
|
||||
if (options.enable === false) return
|
||||
|
||||
const path = data.path
|
||||
const exclude = options.exclude
|
||||
const globOptions = options.globOptions
|
||||
const { path } = data
|
||||
const { exclude, globOptions } = options
|
||||
|
||||
let excludeString = exclude || ''
|
||||
if (exclude && Array.isArray(exclude)) excludeString = exclude.join('')
|
||||
|
@ -74,9 +72,8 @@ function minifyJs (str, data) {
|
|||
const options = hexo.config.minify.js
|
||||
if (options.enable === false) return
|
||||
|
||||
const path = data.path
|
||||
const exclude = options.exclude
|
||||
const globOptions = options.globOptions
|
||||
const { path } = data
|
||||
const { exclude, globOptions } = options
|
||||
|
||||
let excludeString = exclude || ''
|
||||
if (exclude && Array.isArray(exclude)) excludeString = exclude.join('')
|
||||
|
@ -103,16 +100,15 @@ function minifySvg () {
|
|||
// Return if disabled.
|
||||
if (options.enable === false) return
|
||||
|
||||
const route = hexo.route
|
||||
const { route } = hexo
|
||||
const routeList = route.list()
|
||||
const include = options.include
|
||||
const globOptions = options.globOptions
|
||||
const { globOptions, include } = options
|
||||
|
||||
let includeString = include || ''
|
||||
if (include && Array.isArray(include)) includeString = include.join('')
|
||||
if (includeString && includeString.includes('/')) globOptions.basename = false
|
||||
|
||||
return Promise.all((micromatch(routeList, include, globOptions)).map(path => {
|
||||
return Promise.all((micromatch(routeList, include, globOptions)).map((path) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// Grab all assets using hexo router
|
||||
const assetPath = route.get(path)
|
||||
|
@ -142,16 +138,15 @@ function gzipFn () {
|
|||
// Return if disabled.
|
||||
if (options.enable === false) return
|
||||
|
||||
const route = hexo.route
|
||||
const { route } = hexo
|
||||
const routeList = route.list()
|
||||
const include = options.include
|
||||
const globOptions = options.globOptions
|
||||
const { globOptions, include } = options
|
||||
|
||||
let includeString = include || ''
|
||||
if (include && Array.isArray(include)) includeString = include.join('')
|
||||
if (includeString && includeString.includes('/')) globOptions.basename = false
|
||||
|
||||
return Promise.all((micromatch(routeList, include, globOptions)).map(path => {
|
||||
return Promise.all((micromatch(routeList, include, globOptions)).map((path) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// Grab all assets using hexo router
|
||||
const assetPath = route.get(path)
|
||||
|
@ -185,16 +180,15 @@ function brotliFn () {
|
|||
// Return if disabled.
|
||||
if (options.enable === false) return
|
||||
|
||||
const route = hexo.route
|
||||
const { route } = hexo
|
||||
const routeList = route.list()
|
||||
const include = options.include
|
||||
const globOptions = options.globOptions
|
||||
const { globOptions, include } = options
|
||||
|
||||
let includeString = include || ''
|
||||
if (include && Array.isArray(include)) includeString = include.join('')
|
||||
if (includeString && includeString.includes('/')) globOptions.basename = false
|
||||
|
||||
return Promise.all((micromatch(routeList, include, globOptions)).map(path => {
|
||||
return Promise.all((micromatch(routeList, include, globOptions)).map((path) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// Grab all assets using hexo router
|
||||
const assetPath = route.get(path)
|
||||
|
|
Loading…
Reference in New Issue