Skip to content

Commit

Permalink
fix(imagemin): use imagemin-svgo correctly (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Aug 18, 2021
1 parent 6c7d0e4 commit 932a40f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/silent-news-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@pkgr/imagemin": patch
---

fix(imagemin): use imagemin-svgo correctly
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"@types/react": "^17.0.18",
"@types/react-dom": "^17.0.9",
"@types/resolve": "^1.20.1",
"@types/svgo": "^2.3.1",
"@types/webpack-dev-server": "^3.11.5",
"@types/webpack-env": "^1.16.2",
"@types/workbox-webpack-plugin": "^5.1.8",
Expand Down
1 change: 1 addition & 0 deletions packages/imagemin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"imagemin-upng": "^3.0.0",
"imagemin-webp": "^6.0.0",
"is-glob": "^4.0.1",
"svgo": "^2.4.0",
"tiny-glob": "^0.2.9",
"tslib": "^2.3.1"
},
Expand Down
19 changes: 6 additions & 13 deletions packages/imagemin/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fs from 'fs'

import { Plugin } from 'imagemin'
import { extendDefaultPlugins } from 'svgo'

const plugins = (
[
Expand Down Expand Up @@ -34,23 +35,15 @@ const plugins = (
[
'svgo',
{
plugins: [
plugins: extendDefaultPlugins([
{
removeViewBox: false,
name: 'removeViewBox',
active: false,
},
],
},
],
[
'webp',
{
plugins: [
{
removeViewBox: false,
},
],
]),
},
],
['webp'],
] as const
).map(async ([name, opts]) =>
(
Expand Down
15 changes: 10 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3089,6 +3089,11 @@
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c"
integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==

"@types/svgo@^2.3.1":
version "2.3.1"
resolved "https://registry.yarnpkg.com/@types/svgo/-/svgo-2.3.1.tgz#85442587bc72bbfb92f3721020e28d678b8744ec"
integrity sha512-L7gdQLO8cfGKksOVtlpS0jwh04SL3W7xe+efuWbNnfSwl3cKSdgX0gLl5VnHDtSAX//xfCbEgB+RSN64tfShqQ==

"@types/tapable@^1":
version "1.0.8"
resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.8.tgz#b94a4391c85666c7b73299fd3ad79d4faa435310"
Expand Down Expand Up @@ -14283,13 +14288,13 @@ svgo@^1.2.2, svgo@^1.3.2:
unquote "~1.1.1"
util.promisify "~1.0.0"

svgo@^2.1.0, svgo@^2.3.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/svgo/-/svgo-2.3.1.tgz#603a69ce50311c0e36791528f549644ec1b3f4bc"
integrity sha512-riDDIQgXpEnn0BEl9Gvhh1LNLIyiusSpt64IR8upJu7MwxnzetmF/Y57pXQD2NMX2lVyMRzXt5f2M5rO4wG7Dw==
svgo@^2.1.0, svgo@^2.3.0, svgo@^2.4.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/svgo/-/svgo-2.4.0.tgz#0c42653101fd668692c0f69b55b8d7b182ef422b"
integrity sha512-W25S1UUm9Lm9VnE0TvCzL7aso/NCzDEaXLaElCUO/KaVitw0+IBicSVfM1L1c0YHK5TOFh73yQ2naCpVHEQ/OQ==
dependencies:
"@trysound/sax" "0.1.1"
chalk "^4.1.0"
colorette "^1.2.2"
commander "^7.1.0"
css-select "^4.1.3"
css-tree "^1.1.2"
Expand Down

0 comments on commit 932a40f

Please sign in to comment.