Skip to content

Commit

Permalink
fix(cb/ccp): remove attrs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Mar 29, 2023
1 parent 222b185 commit b4db6a2
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@svgr/plugin-svgo": "^7.0.0",
"@types/fs-extra": "^11.0.0",
"@types/minimist": "^1.2.2",
"@types/svgo": "^2.6.3",
"@types/svgo": "^3.0.0",
"fs-extra": "^11.0.0",
"minimist": "^1.2.6",
"recursive-readdir-files": "^2.3.0"
Expand Down
1 change: 1 addition & 0 deletions icons/cb/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
!.npmignore
!tsconfig.json
!package.json
!svgo.config.js
!data
!README.md
21 changes: 21 additions & 0 deletions icons/cb/svgo.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

/** @type {import('svgo').Config} */
module.exports = {
multipass: true,
js2svg: {
indent: 2, // string with spaces or number of spaces. 4 by default
pretty: true, // boolean, false by default
},
plugins: [
'removeComments',
'removeDimensions',
'cleanupAttrs',
{
name: 'removeAttrs',
fn: (ast, params, info) => {
delete ast.children[0]?.attributes['style'];
delete ast.children[0]?.attributes['xml:space'];
},
}
]
}
1 change: 1 addition & 0 deletions icons/ccp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*
!.gitignore
!.npmignore
!svgo.config.js
!tsconfig.json
!package.json
!data
Expand Down
25 changes: 25 additions & 0 deletions icons/ccp/svgo.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

/** @type {import('svgo').Config} */
module.exports = {
multipass: true,
js2svg: {
indent: 2, // string with spaces or number of spaces. 4 by default
pretty: true, // boolean, false by default
},
plugins: [
'cleanupIds',
'removeComments',
'removeDimensions',
{
name: 'removeAttrs',
fn: (ast, params, info) => {
delete ast.children[0]?.attributes['id'];
delete ast.children[0]?.attributes['y'];
delete ast.children[0]?.attributes['x'];
delete ast.children[0]?.attributes['version'];
delete ast.children[0]?.attributes['style'];
delete ast.children[0]?.attributes['xml:space'];
},
}
]
}
2 changes: 1 addition & 1 deletion icons/wl/svgo.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ module.exports = {
}
},
]
}
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
]
},
"devDependencies": {
"@svgr/core": "^7.0.0",
"@types/webpack": "^5.28.0",
"svgo": "^3.0.2",
"cpy-cli": "^4.1.0",
"husky": "^8.0.1",
"lerna": "^6.0.0",
Expand Down

0 comments on commit b4db6a2

Please sign in to comment.