mirror of https://github.com/curbengh/hexo-yam
fix(svg): ignore empty input
This commit is contained in:
parent
a6e2ea0879
commit
a6f434ff8d
|
@ -154,12 +154,8 @@ function minifySvg () {
|
||||||
if (assetTxt.length) {
|
if (assetTxt.length) {
|
||||||
try {
|
try {
|
||||||
const { data } = svgOptimize(assetTxt, { ...options, plugins })
|
const { data } = svgOptimize(assetTxt, { ...options, plugins })
|
||||||
if (data) {
|
if (verbose) logFn.call(this, assetTxt, data, path, 'svg')
|
||||||
if (verbose) logFn.call(this, assetTxt, data, path, 'svg')
|
resolve(route.set(path, data))
|
||||||
resolve(route.set(path, data))
|
|
||||||
} else {
|
|
||||||
reject(new Error(`Path: ${path}\nEmpty svg input`))
|
|
||||||
}
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
reject(new Error(`Path: ${path}\n${err}`))
|
reject(new Error(`Path: ${path}\n${err}`))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue