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

18 Commits

Author SHA1 Message Date
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
316a002299
Remove hasAttr and hasAttrLocal usages (#1447)
In most cases simple check for null is enough.
2021-03-22 01:24:59 +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
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
Keith Clark
abffd7db09 moveGroupAttrsToElems: new transform attribute shouldn't be a reference 2016-04-26 20:14:18 +01:00
GreLI
7d556d06b9 Don't move transforms into referenced group items
Fixes #532
2016-04-25 13:36:02 +03:00
GreLI
a7f62d8984 Formatting 2015-06-21 19:13:41 +03:00
Yoshiya Hinosawa
3f8e6fd15c Fix lint 2015-06-12 00:25:32 +09:00
Yoshiya Hinosawa
8e6b365c40 Add --show-plugins option 2015-06-07 19:35:49 +09:00
GreLI
84220ce1dc Add classes instead if rewriting when collapsing groups. Fixes #288 2015-03-15 13:01:10 +03:00
GreLI
290d610f27 Limited linking checks to referencing props 2015-01-25 20:00:40 +03:00
GreLI
17d29e9138 Don't move transform attribute to elems if there is linked object to transform. Fixes #162 2014-11-04 21:01:03 +03:00
Nathan Muir
d0a4e91e95 moveGroupAttrsToElems now applies transforms to sub-groups & text. 2013-11-18 22:39:50 +02:00
deepsweet
2816424ed7 global refactoring dump 2013-04-09 22:06:27 +03:00
deepsweet
30a3397a27 move or just leave transform attr from Group to the inner Path Elems (close #86) 2013-01-18 14:16:27 +02:00