RazrFalcon / svgcleaner

svgcleaner could help you to clean up your SVG files from the unnecessary data.
GNU General Public License v2.0
1.62k stars 93 forks source link

Remove fill-* / stroke-* attributes when fill / stroke not defined #197

Open lexeii opened 5 years ago

lexeii commented 5 years ago

When fill is absent (fill="none") then fill-* attributes has no sense:

Now:

fill:none;fill-rule:evenodd

Desired:

fill:none

Additionally, when stroke not defined then stroke-* attributes are excessive:

Now:

fill:#333;stroke-width:2;stroke-linecap:round;stroke-linejoin:round

Desired:

fill:#333

Added: if path contains only individual segments (or arcs):

m 13.5,18.5 1,-2 m -6,2 1,-2 m 6.5,2 1,-2 m -6,2 1,-2 m -6,2 1,-2

I.e. it don't contains joined lines, then long definition like stroke-linejoin="round" may be removed.

Still using old svgcleaner 0.9.1, I apologize if this has already been improved in newer versions.