1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-10 19:20:57 +03:00
Commit Graph

16 Commits

Author SHA1 Message Date
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
4cacd9e676 Migrate ast traversing into xast module (#1434)
Replaced JSAPI methods with new utilities

- querySelectorAll(node, selector)
- querySelector(node, selector)
- matches(node, selector)
- closestByName(node, elementName)
- traverse(node, fn)

New traverse replaced many in-place implementations.
2021-03-19 11:06:41 +03:00
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
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
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
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
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
00ec0f71fe Format all plugins with prettier 2021-03-09 19:58:00 +03:00
95f7603983 Fix removeUnusedNS not counting usage in <svg> tag
Close #1107
2019-05-19 20:44:36 +03:00
a7f62d8984 Formatting 2015-06-21 19:13:41 +03:00
8e6b365c40 Add --show-plugins option 2015-06-07 19:35:49 +09:00
2816424ed7 global refactoring dump 2013-04-09 22:06:27 +03:00
5485010269 'use strict' motherfucker! do you use it?! 2012-11-27 22:51:31 +02:00
bb6323c7f8 more JSHint 2012-11-27 16:53:05 +02:00
906613779a plugins/removeUnusedNS: correct jsdoc 2012-10-17 21:21:30 +03:00
3204a06ca5 new plugin removeUnusedNS 2012-10-15 19:29:26 +03:00