Skip to content

Commit

Permalink
style: Standard JS
Browse files Browse the repository at this point in the history
  • Loading branch information
weyusi committed May 2, 2019
1 parent cceae36 commit cdee4c0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,22 @@ if (hexo.config.neat_enable === true) {
hexo.config.neat_svg = Object.assign({
enable: true,
logger: false,
include: ['*.svg','!*.min.svg'],
include: ['*.svg', '!*.min.svg'],
plugin: []
}, hexo.config.neat_svg)

// gzip compression
hexo.config.neat_gzip = Object.assign({
enable: true,
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)

// brotli compression
hexo.config.neat_brotli = Object.assign({
enable: true,
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)

const filter = require('./lib/filter')
Expand Down
20 changes: 10 additions & 10 deletions lib/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,16 @@ function logicSvg () {
assetPath.on('end', () => {
if (assetTxt.length) {
// Minify using svgo
new svgo(options).optimize(assetTxt).then(function(result) {
// Replace the original file with the minified.
route.set(path, result.data)
// Logging
let saved = ((assetTxt.length - result.data.length) / assetTxt.length * 100).toFixed(2)
if (options.logger) {
let log = hexo.log || console.log
log.log('Minify the svg: %s [%s saved]', path, saved + '%')
}
resolve(assetTxt)
new svgo(options).optimize(assetTxt).then(function (result) {
// Replace the original file with the minified.
route.set(path, result.data)
// Logging
let saved = ((assetTxt.length - result.data.length) / assetTxt.length * 100).toFixed(2)
if (options.logger) {
let log = hexo.log || console.log
log.log('Minify the svg: %s [%s saved]', path, saved + '%')
}
resolve(assetTxt)
})
}
})
Expand Down

0 comments on commit cdee4c0

Please sign in to comment.