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

29 Commits

Author SHA1 Message Date
XhmikosR
7b6e73048f
moveElemsAttrsToGroup.js: fix missing return value in Array.every() (#1525) 2021-08-14 13:12:23 +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
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
6f2f62c5ee
Access attributes directly (#1433)
Got rid from `.attrs`, `.attr()` and `.addAttr()` usages
2021-03-18 18:53:20 +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
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
3e1bfd528d Convert attributes to xast with proxy fallback
There is a lot of attributes manipulation which is hard to remove at
once. In this diff I added `attributes` object and wrapped it as proxy
for `attrs` field.
2021-03-10 23:11:09 +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
Bogdan Chadkin
a7cc20bb43
Setup recommended eslint preset (#1345)
This is usually enough to prevent silly mistakes.
Formatting will be done by prettier after merging pull requests.
2021-02-19 15:26:07 +03:00
GreLI
1966bb60a5 Don't pass style attributes is present of class. Fixes #489 2016-03-08 19:50:54 +03:00
GreLI
25fc738c03 Fixed transform moving around the mask as well 2016-02-15 14:09:04 +03:00
GreLI
7af242b611 Fixed transform moving around the clip. Fixes #446 2015-11-08 19:10:46 +03: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
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
deepsweet
252fe5f06a plugins/moveElemsAttrsToGroup: additional check for transform attr 2012-11-30 17:32:44 +02:00
deepsweet
5485010269 'use strict' motherfucker! do you use it?! 2012-11-27 22:51:31 +02:00
deepsweet
bb6323c7f8 more JSHint 2012-11-27 16:53:05 +02:00
deepsweet
87cdc92b37 plugins/moveElemsAttrsToGroup: fix inheitable only attrs array (fix #47) 2012-11-23 18:11:21 +04:00
deepsweet
1e86425dcf plugins/moveElemsAttrsToGroup: should affect only inheritable attributes (fix #46) 2012-11-18 20:05:36 +02:00
deepsweet
aa10a8b5de lib/svgo/ 2012-11-09 14:21:06 +02:00
deepsweet
50b825d305 plugins/moveElemsAttrsToGroup: merge split-level transforms instead of replacing (fix #10) 2012-10-20 21:41:19 +03:00
deepsweet
291631509f lib/jsAPI: simplification and refactoring 2012-10-15 08:28:25 +03:00
deepsweet
93b1078a24 plugins/moveElemsAttrsToGroup: fix bug with a wrong attrs intersecting 2012-09-29 14:26:26 +04:00
deepsweet
13af2ed95e go! 2012-09-27 14:06:28 +03:00