Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zat package removes mask property when compressing SVGs #352

Open
kibin opened this issue Dec 22, 2020 · 0 comments
Open

zat package removes mask property when compressing SVGs #352

kibin opened this issue Dec 22, 2020 · 0 comments

Comments

@kibin
Copy link

kibin commented Dec 22, 2020

When I run zat package, all my SVG-icons look broken.
When I start to investigate what’s going on I see that all the mask properties has been stripped from the resulting file.

Before (see next-to-last string, path tag):

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
  <defs/>
  <defs>
    <mask id="b">
      <radialGradient id="a">
        <stop offset="0" stop-color="#fff"/>
        <stop offset="1"/>
      </radialGradient>
      <text y="50" fill="url(#a)" font-family="Arial" font-size="20">
        SVG Mask
      </text>
    </mask>
  </defs>
  <path fill="#B63FC4" d="M0 0h100v100H0z" mask="url(#b)"/>
</svg>

After (with all the white spaces returned):

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
  <defs/>
  <defs>
    <mask id="b">
      <radialGradient id="a">
        <stop offset="0" stop-color="#fff"/>
        <stop offset="1"/>
      </radialGradient>
      <text y="50" fill="url(#a)" font-family="Arial" font-size="20">
        SVG Mask 
      </text>
    </mask>
  </defs>
  <path fill="#B63FC4" d="M0 0h100v100H0z"/>
</svg>

You can see that the last <path> tag has no mask property, which breaks SVG and turns it into a simple rectangle instead of text with a mask.
Also it’s strange that this operation (compressing) is destructive on the source (it’s affecting svgs in zat/assets).

@kibin kibin changed the title zat package removes properties when compressing SVGs zat package removes mask property when compressing SVGs Dec 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant