mirror of https://github.com/curbengh/hexo-yam
style: Standard JS
This commit is contained in:
parent
cceae36368
commit
cdee4c0768
6
index.js
6
index.js
|
@ -37,7 +37,7 @@ if (hexo.config.neat_enable === true) {
|
||||||
hexo.config.neat_svg = Object.assign({
|
hexo.config.neat_svg = Object.assign({
|
||||||
enable: true,
|
enable: true,
|
||||||
logger: false,
|
logger: false,
|
||||||
include: ['*.svg','!*.min.svg'],
|
include: ['*.svg', '!*.min.svg'],
|
||||||
plugin: []
|
plugin: []
|
||||||
}, hexo.config.neat_svg)
|
}, hexo.config.neat_svg)
|
||||||
|
|
||||||
|
@ -45,14 +45,14 @@ if (hexo.config.neat_enable === true) {
|
||||||
hexo.config.neat_gzip = Object.assign({
|
hexo.config.neat_gzip = Object.assign({
|
||||||
enable: true,
|
enable: true,
|
||||||
logger: false,
|
logger: false,
|
||||||
include: ['*.html','*.css','*.js','*.txt','*.ttf','*.atom','*.stl','*.xml','*.svg','*.eot','*.json']
|
include: ['*.html', '*.css', '*.js', '*.txt', '*.ttf', '*.atom', '*.stl', '*.xml', '*.svg', '*.eot', '*.json']
|
||||||
}, hexo.config.neat_gzip)
|
}, hexo.config.neat_gzip)
|
||||||
|
|
||||||
// brotli compression
|
// brotli compression
|
||||||
hexo.config.neat_brotli = Object.assign({
|
hexo.config.neat_brotli = Object.assign({
|
||||||
enable: true,
|
enable: true,
|
||||||
logger: false,
|
logger: false,
|
||||||
include: ['*.html','*.css','*.js','*.txt','*.ttf','*.atom','*.stl','*.xml','*.svg','*.eot','*.json']
|
include: ['*.html', '*.css', '*.js', '*.txt', '*.ttf', '*.atom', '*.stl', '*.xml', '*.svg', '*.eot', '*.json']
|
||||||
}, hexo.config.neat_brotli)
|
}, hexo.config.neat_brotli)
|
||||||
|
|
||||||
const filter = require('./lib/filter')
|
const filter = require('./lib/filter')
|
||||||
|
|
|
@ -107,16 +107,16 @@ function logicSvg () {
|
||||||
assetPath.on('end', () => {
|
assetPath.on('end', () => {
|
||||||
if (assetTxt.length) {
|
if (assetTxt.length) {
|
||||||
// Minify using svgo
|
// Minify using svgo
|
||||||
new svgo(options).optimize(assetTxt).then(function(result) {
|
new svgo(options).optimize(assetTxt).then(function (result) {
|
||||||
// Replace the original file with the minified.
|
// Replace the original file with the minified.
|
||||||
route.set(path, result.data)
|
route.set(path, result.data)
|
||||||
// Logging
|
// Logging
|
||||||
let saved = ((assetTxt.length - result.data.length) / assetTxt.length * 100).toFixed(2)
|
let saved = ((assetTxt.length - result.data.length) / assetTxt.length * 100).toFixed(2)
|
||||||
if (options.logger) {
|
if (options.logger) {
|
||||||
let log = hexo.log || console.log
|
let log = hexo.log || console.log
|
||||||
log.log('Minify the svg: %s [%s saved]', path, saved + '%')
|
log.log('Minify the svg: %s [%s saved]', path, saved + '%')
|
||||||
}
|
}
|
||||||
resolve(assetTxt)
|
resolve(assetTxt)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue