1
0
mirror of https://github.com/svg/svgo.git synced 2025-04-19 10:22:15 +03:00

13 Commits

Author SHA1 Message Date
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
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
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
00ec0f71fe Format all plugins with prettier 2021-03-09 19:58:00 +03:00
GreLI
d23355e91a removeAttrs: add optional value filter (#977) 2019-02-24 22:01:01 +03:00
Rob Levin
0fe5368e0e Add the preserveCurrentColor option to the removeAttrs plugin. (#1000)
Add the preserveCurrentColor option to the removeAttrs plugin.
2019-02-24 20:20:36 +03:00
Mike Street
645908923b Allow element seperator to be changed in config
This resolves #557 as you can pass in a different character for element seperation (e.g. `^`
2017-10-23 22:54:02 +03:00
GreLI
81e1ebe475 removeAttrs doc addition. Resolves #469 2016-02-28 23:53:02 +03:00
cy6erskunk
492f12c02f Add description for removeAttrs plugin
Add description to eliminate ugly `undefined` in `--show-plugins` output
2015-08-07 15:39:26 +03:00
Benny Schudel
2f33f9eab1 Added removeAttrsPlugin and extended test to have optional params passed along 2014-03-27 14:42:14 +01:00