Closed FarhanShares closed 1 year ago
I can send a PR for that. Even we can have another config, e.g. clearNestedSize: true | false
to also preserve the existing behaviour.
Do you think clearSize
should be true
by default?
I can set it to false
by default, I agree it can generate some bugs.
The extra option clearNestedSize
should be a very insteresting feature, yes. I will check if a system like that can be added easily ;)
Maybe we can turn off clearSize
by default and It's job is to just clearing the outermost sizes (i.e. from parent <svg> tag only
& not it's children)
We can have clearNestedSize
, with a default value of false as well. Which will just clear the sizes for the children
tags (e.g. <rect>, <cx>, <circle>
etc) of the parent
On the other hand, we can go for another approach if that much granular control is not necessary,
clearSize: 'all' | 'parent' | 'none'
and it'll either clear all sizes or only the sizes from the parent element.
The last option is really wonderful! I set this type to clearClasses
, clearSize
and clearStyles
to allow customization, these options are set to none
by default. Thanks for this excellent proposition. ;)
I publish 0.0.5
version, tell if it's okay with this version!
Cool. Thanks for updating it. How about having a naming consistency on the config properties too? E.g. either singular or plural.
Or
Though doesn't matter much, it's more about aesthetics.
You are right, I publish a version with singular name options ;)
Currently, setting the clearSize: true in the config clears all the height & width attributes that may be present on a SVG file,
For that reason the following:
Will be transformed into:
As a result, the rect will not be shown (it can happen on other elements as well) & it'll result in unexpected output. Clearing the nested height & width attributes might not be necessary. I think only applying it to the parent or outermost element is sufficient, otherwise it is currently affecting some SVGs that I've tested with.
Also, the default value for
clearSize
isfalse
written in the in the doc / readme, however it is actually behaving like the value istrue
.