posthtml / htmlnano

Modular HTML minifier, built on top of the PostHTML

Home Page:https://htmlnano.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

some <rect> get trimmed in inline SVG

yw662 opened this issue · comments

commented

The inline svg is:

        g(id="bg")
            rect(width="1000" height="1000")
            path(d="M400,0 L650,250 Q750,350,650,450 L0,1100 L0,0")
            path(d="M450,0 L630,180 Q715,265,800,180 L980,0")
            path(d="M1000,20 L700,320 Q600,420,700,520 L1000,820")

the in the first line is trimmed by htmlnano.

output:

<g id="bg_header"><path d="M0 0h1000v1000H0z"></path><path d="M400 0l250 250q100 100 0 200L0 1100V0M450 0l180 180q85 85 170 0L980 0"></path><path d="M1000 20L700 320q-100 100 0 200l300 300"></path></g>
commented

So it technically is not trimmed, but translated from <rect> into <path>.

However, this does break thing, like style sheets, querySelector, etc.

Thanks for posting this issue! I’ll look into it.

Fixed.