Bogdan Chadkin
e3c6873243
Refactor collapseGroups ( #1572 )
...
- migrated to visitor plugin api
- covered with tsdoc
Part of the code is still complicated. Will come to it eventually.
2021-09-16 01:51:08 +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
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
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
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
7a07b8436d
Fix collapseGroups plugin affecting switch and subgroups
...
Fix #1020
2018-09-16 17:38:34 +03:00
Sasha Joseph
b2b9acb23e
tweak: do not collapse group properties to children if they contain filters.
2018-09-15 14:45:46 +03:00
Dan Burzo
d968d45a25
Fixes #915 for collapseGroups ( #916 )
...
Fix #915 for collapseGroups: overwrite value with parent value
When the inner element has the value, don't remove the parent groups that defines what that value is
2018-03-02 21:34:21 +03:00
GreLI
54de6f7592
Correct check for switch
2017-11-21 22:37:03 +03:00
GreLI
eb3b4b8188
Prevent removing groups that are direct child of "<switch>". Fix #845
2017-11-21 21:58:17 +03:00
caub
4cf413908e
remove useless switch groups
2017-04-02 19:07:42 +02:00
GreLI
13e09e4642
Don't collapse groups with same non-inheritable attribue. Fix #550
2016-12-25 18:17:39 +03:00
GreLI
6e9854a046
Don't collapse a group with element when both have classes.
...
Fixes #572 (comment)
2016-08-24 22:01:19 +03:00
GreLI
44d6958db2
Don't pass mask around transform in collapseGroups.
...
Fixes #572
2016-08-24 22:01:18 +03:00
GreLI
6bd922258d
Fix hinting issue
2016-04-27 15:56:41 +03:00
GreLI
2bbabeedb0
Prevented collapsing group with passing animated attribute
...
Fixes #534
2016-04-25 14:03:28 +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
GreLI
4c1aad9889
Check for all animation properties collapseGroups
2015-03-29 18:35:18 +03:00
GreLI
4d966b7ceb
Don't collapse groups which have animations. Fixes #214
2015-03-22 18:12:09 +03:00
GreLI
84220ce1dc
Add classes instead if rewriting when collapsing groups. Fixes #288
2015-03-15 13:01:10 +03:00
GreLI
91262b7c30
Don't collapse ‘g’ inside ‘switch’. Fixes #324
2015-03-15 01:15:12 +03:00
GreLI
85def41186
Collapse groups with one command. Correctly update parent references.
2015-02-24 23:53:47 +03:00
GreLI
5a51022b25
Don't pass 'clip-path' attr to shape elements at all. Fixes #231
2015-02-08 23:39:35 +03:00
GreLI
d9ad4183fa
Don't move attrs to child if it has id
2014-11-04 22:25:13 +03:00
GreLI
7c68e55c07
Don't move 'clip-path' to inner element if it has 'transform'. Fixes #254
2014-11-04 21:35:34 +03:00
Nathan Muir
600f37cb2d
Possible solution to issue #132 with test cases.
...
collapse group would merge transforms without respect for clipPath.
2013-11-18 22:33:29 +02:00
deepsweet
2816424ed7
global refactoring dump
2013-04-09 22:06:27 +03: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
aa10a8b5de
lib/svgo/
2012-11-09 14:21:06 +02:00
deepsweet
2d448f0d2e
lib/jsAPI: minor corrections
2012-10-29 01:48:06 +03:00
deepsweet
cbc7b38b4e
plugins/collapseGroups: fix #13
2012-10-21 12:16:59 +03:00
deepsweet
291631509f
lib/jsAPI: simplification and refactoring
2012-10-15 08:28:25 +03:00
deepsweet
a6bf1186f7
plugins/collapseGroups: fix wrong example in jsdoc
2012-10-02 10:26:47 +04:00
deepsweet
e903dcba8d
plugins/collapseGroups: fix bug with a wrong content flattening
2012-09-29 14:27:22 +04:00
deepsweet
13af2ed95e
go!
2012-09-27 14:06:28 +03:00