mirror of https://github.com/curbengh/hexo-yam
Merge pull request #135 from curbengh/dependabot/npm_and_yarn/svgo-3.0.0
chore(deps): bump svgo from 2.8.0 to 3.0.0
This commit is contained in:
commit
b0575e6fdc
|
@ -133,7 +133,7 @@ minify:
|
|||
# Retain comments
|
||||
removeComments: false
|
||||
# Do not remove unused ID attributes
|
||||
cleanupIDs: false
|
||||
cleanupIds: false
|
||||
```
|
||||
- For more options, see [svgo](https://github.com/svg/svgo).
|
||||
- **globOptions** - See [globbing](#globbing) section.
|
||||
|
|
|
@ -152,12 +152,12 @@ function minifySvg () {
|
|||
assetPath.on('data', (chunk) => (assetTxt += chunk))
|
||||
assetPath.on('end', async () => {
|
||||
if (assetTxt.length) {
|
||||
const { data, error } = svgOptimize(assetTxt, { ...options, plugins })
|
||||
if (data) {
|
||||
try {
|
||||
const { data } = svgOptimize(assetTxt, { ...options, plugins })
|
||||
if (verbose) logFn.call(this, assetTxt, data, path, 'svg')
|
||||
resolve(route.set(path, data))
|
||||
} else if (error) {
|
||||
reject(new Error(`Path: ${path}\n${error}`))
|
||||
} catch (err) {
|
||||
reject(new Error(`Path: ${path}\n${err}`))
|
||||
}
|
||||
}
|
||||
resolve()
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
"html-minifier": "^4.0.0",
|
||||
"micromatch": "^4.0.2",
|
||||
"minify-xml": "^3.2.0",
|
||||
"svgo": "^2.4.0",
|
||||
"svgo": "^3.0.0",
|
||||
"terser": "^5.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -71,7 +71,7 @@ describe('svg', () => {
|
|||
|
||||
test('option', async () => {
|
||||
const customOpt = {
|
||||
cleanupIDs: false
|
||||
cleanupIds: false
|
||||
}
|
||||
hexo.config.minify.svg.plugins = customOpt
|
||||
plugins = [{
|
||||
|
@ -117,10 +117,14 @@ describe('svg', () => {
|
|||
const input = '{}'
|
||||
hexo.route.set(path, input)
|
||||
|
||||
const { error } = svgOptimize(input, { plugins })
|
||||
|
||||
expect(error).toBeDefined()
|
||||
await expect(s()).rejects.toThrow(`Path: ${path}\n${error}`)
|
||||
let expected
|
||||
try {
|
||||
svgOptimize(input, { plugins })
|
||||
} catch (err) {
|
||||
expected = err
|
||||
}
|
||||
expect(expected).toBeDefined()
|
||||
await expect(s()).rejects.toThrow(`Path: ${path}\n${expected}`)
|
||||
})
|
||||
|
||||
test('include - exclude *.min.svg by default', async () => {
|
||||
|
|
Loading…
Reference in New Issue