Bogdan Chadkin
9b8f13e911
Add plugin types ( #1527 )
...
Covered following plugins
- addAttributesToSVGElement.js
- addClassesToSVGElement.js
- cleanupAttrs.js
- convertEllipseToCircle.js
- removeAttributesBySelector.js
- removeAttrs.js
- removeComments.js
- removeDesc.js
- removeDoctype.js
- removeElementsByAttr.js
- removeEmptyText.js
- removeMetadata.js
- removeRasterImages.js
- removeScriptElement.js
- removeStyleElement.js
- removeTitle.js
- removeXMLProcInst.js
2021-08-15 13:52:41 +03:00
Bogdan Chadkin
7ec255719c
Refactor adhoc plugins with visitor api ( #1526 )
...
- addAttributesToSVGElement
- addClassesToSVGElement
- removeAttributesBySelector
- removeAttrs
- removeElementsByAttr
2021-08-14 16:48:39 +03:00
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
447f82ca6b
Convert addAttributesToSVGElement to item plugin ( #1448 )
...
"full" plugins prevents from possible optimisation. We need to migrate
all plugins to "perItem" type and later implement visitor plugin api to
allow state.
2021-03-22 01:24:41 +03:00
Bogdan Chadkin
6f2f62c5ee
Access attributes directly ( #1433 )
...
Got rid from `.attrs`, `.attr()` and `.addAttr()` usages
2021-03-18 18:53:20 +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
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
Bogdan Chadkin
c1edce4d2d
Fix error message in addAttributesToSVGElement plugin
...
Ref https://github.com/svg/svgo/issues/1352
2021-02-20 19:04:46 +03:00
Keegan Street
eceb95c310
Updated addElementsToSVGElement plugin to support attribute values, as well as attribute names.
2017-10-25 22:08:58 +03:00
GreLI
055e303607
Tune plugins
2017-10-22 19:32:24 +03:00
unknown
34d9500844
Adds plugin for adding attributes to svg element.
2016-05-12 08:11:29 -04:00