Bogdan Chadkin
07f8d606e0
Implement preset-default plugin ( #1513 )
...
I saw complaints about `extendDefaultPlugins` api
- it cannot be used when svgo is installed globally
- it requires svgo to be installed when using svgo-loader or svgo-jsx
- it prevents using serializable config formats like json
In this diff I introduced the new plugin which is a bundle of all
default plugins.
```js
module.exports = {
plugins: [
'preset_default',
// or
{
name: 'preset_default',
floatPrecision: 4,
overrides: {
convertPathData: {
applyTransforms: false
}
}
}
]
}
```
2021-08-13 19:07:08 +03:00
Bogdan Chadkin
07928fc77e
Replace removeAttr with delete operator ( #1432 )
...
delete operator is more explicit and not much harder to use.
2021-03-17 21:40:06 +03:00
Bogdan Chadkin
8098ab7fb6
Replace attributes iterators with for/of ( #1431 )
...
These iterators allows to directly manipulate passed value
which does not let us to get rid from legacy "attrs" field.
Object.entries makes it easier to get an access to both attribute
name and value.
2021-03-17 12:50:16 +03:00
Bogdan Chadkin
5314c12c99
Convert element children to xast
...
Ref https://github.com/syntax-tree/xast
Renamed content to children to match xast spec.
2021-03-11 12:29:13 +03:00
Bogdan Chadkin
e82a672bbf
Prepare root and element nodes for xast
...
Ref https://github.com/syntax-tree/xast
- added type: root | element
- renamed elem to name
- replaced "elem" property checks with check for correct type
2021-03-10 18:49:26 +03:00
Bogdan Chadkin
d1d6e5efe8
Remove prefix/local support in elements and attributes ( #1413 )
...
These parts of element and attribute name are easy to extract.
Now we can easily replace attrs with xast attributes object.
2021-03-10 13:26:15 +03:00
Bogdan Chadkin
00ec0f71fe
Format all plugins with prettier
2021-03-09 19:58:00 +03:00
Sebastian Kreft
0394bf0ea6
refactor: replace uses of for in ( #1382 )
...
Replace the uses of `for in` with `for of` and `Object.entries`/`Object.values`/`Object.keys`.
One case was further simplified by using a spread.
2021-02-27 23:17:30 +03:00
GreLI
a4fb3a4a7e
Prevent removeUnknownsAndDefaults removing attributes from elements with id
...
Fix #959
2018-09-16 16:24:53 +03:00
Mike Morici
f92629fc54
Add keepRoleAttr option for removeUnknownsAndDefaults ( #1002 )
2018-09-15 14:48:15 +03:00
David Clark
5c1aab8ad8
Add keepAriaAttrs to removeUnknownsAndDefaults
...
Closes #684 .
2017-06-13 13:22:56 -07:00
GreLI
8b290bf976
Don't remove same transform in inner element (removeUnknownsAndDefaults). Fix #549
2016-12-25 18:17:39 +03:00
GreLI
65efced355
Process “foreignObject”: cleanup editors content and remove itself if is empty.
...
Remove doctype with entities.
Fixes #533
2016-04-24 21:29:01 +03:00
Xander Victory
948cf1bf59
Move defined guard to inside the element check, refactor slice conditional to allow removing elements which we have no idea about (an Unknown) inside the current element.
2015-10-08 21:50:20 +08:00
Xander Victory
bbf2028de8
fix TypeError("Can't get property contents of undefined") when element name is not in the collection.
2015-10-06 15:16:45 +08:00
GreLI
a7f62d8984
Formatting
2015-06-21 19:13:41 +03:00
Yoshiya Hinosawa
8e6b365c40
Add --show-plugins option
2015-06-07 19:35:49 +09:00
GreLI
9041175c52
Don't remove id in <svg> tag in removeUnknownsAndDefaults since it's zone of responsibility of cleanupIDs.
...
Resolves #318 .
2015-03-29 20:41:45 +03:00
GreLI
ec70b37666
Simplified inherited attrs checking in removeUnknownsAndDefaults
2015-03-29 20:11:58 +03:00
GreLI
de1629faf9
Don't remove data-* attributes. Resolves #301
2015-02-15 15:11:42 +03:00
GreLI
5e7caa49dc
Code styling
2015-02-08 19:31:55 +03:00
Kalashnikov Igor
7053bea696
fixing deep inheritance analyzis + remove useless overrides
2014-01-11 21:13:30 +04:00
Kalashnikov Igor
da52d7f311
remove inherited attrs with same value
2014-01-08 23:09:02 +04:00
Kalashnikov Igor
97678a7304
do not remove overriden attributes with default values #161
2014-01-08 22:50:09 +04:00
deepsweet
2816424ed7
global refactoring dump
2013-04-09 22:06:27 +03:00
deepsweet
1b6b3b3026
plugins/removeUnknownsAndDefaults: refactoring and picking up the complete elems+attrs collection ( close #59 )
2012-11-30 17:34:02 +02:00
deepsweet
5485010269
'use strict' motherfucker! do you use it?!
2012-11-27 22:51:31 +02:00
deepsweet
088548db28
plugins/removeUnknownsAndDefaults: remove SVG id attr ( close #54 )
2012-11-24 00:28:09 +04:00
deepsweet
8ba22b7295
plugins/removeUnknownsAndDefaults: merge multiple groupDefaults attrs ( close #50 )
2012-11-23 18:56:36 +04:00
deepsweet
15e4b1a217
plugins/removeUnknownsAndDefaults: remove unknown elements content, attrs and attrs with default values ( close #6 )
2012-11-22 18:57:43 +02:00