Skip to content

Commit

Permalink
fix(cci/ccp/ct/ic): remove attrs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Mar 29, 2023
1 parent b4db6a2 commit 50d95d2
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Example:
},
"devDependencies": {
"icongo": "*",
"tsbb": "^4.0.2"
"tsbb": "^4.0.3"
}
}
```
Expand Down
1 change: 1 addition & 0 deletions icons/cci/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
!.gitignore
!.npmignore
!tsconfig.json
!svgo.config.js
!package.json
!data
!README.md
23 changes: 23 additions & 0 deletions icons/cci/svgo.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

/** @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['version'];
delete ast.children[0]?.attributes['style'];
delete ast.children[0]?.attributes['xml:space'];
},
}
]
}
3 changes: 0 additions & 3 deletions icons/ccp/svgo.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ module.exports = {
pretty: true, // boolean, false by default
},
plugins: [
'cleanupIds',
'removeComments',
'removeDimensions',
{
name: 'removeAttrs',
fn: (ast, params, info) => {
Expand Down
29 changes: 29 additions & 0 deletions icons/ct/svgo.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

/** @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: [
{
name: "removeAttrs",
params: {
attrs: "(stroke-linejoin)"
}
},
{
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'];
delete ast.children[0]?.attributes['xmlns:xlink'];
},
}
]
}
1 change: 1 addition & 0 deletions icons/ic/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
!.npmignore
!tsconfig.json
!package.json
!svgo.config.js
!data
!README.md
!cpy.mjs
31 changes: 31 additions & 0 deletions icons/ic/svgo.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

/** @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: [
'removeXMLNS',
'convertColors',
{
name: "removeAttrs",
params: {
attrs: "(stroke-linejoin|block-progression)"
}
},
{
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'];
delete ast.children[0]?.attributes['xmlns:xlink'];
},
}
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
"lerna": "^6.0.0",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"tsbb": "^4.0.2"
"tsbb": "^4.0.3"
}
}

0 comments on commit 50d95d2

Please sign in to comment.