Svgo: Will empty file with <symbol>.

Created on 24 Aug 2015  路  6Comments  路  Source: svg/svgo

Hi

SVGO simply empties my file:

<svg xmlns="http://www.w3.org/2000/svg">
  <symbol id="PencilSymbol" viewBox="0 0 30.146 30">
    <path d="M18.746,5.006l6.133,6.133L9.356,26.663l-6.131-6.134L18.746,5.006z M29.533,3.528l-2.736-2.735
    c-1.057-1.057-2.773-1.057-3.832,0l-2.621,2.62l6.132,6.133l3.058-3.056C30.351,5.669,30.351,4.347,29.533,3.528L29.533,3.528z
     M0.017,29.15c-0.112,0.502,0.342,0.952,0.844,0.83l6.834-1.658L1.566,22.19L0.017,29.15z M0.017,29.15"/>
  </symbol>

  <symbol id="Vencedores" viewBox="0 0 16.498 30">
    <path d="M7.5,4.502c0.399,0,0.751,0.146,1.051,0.445C8.852,5.248,8.998,5.6,8.998,5.999V30l-4.497-5.4L0,30V5.999
    C0,5,0.399,4.502,1.197,4.502H7.5z M15,0c0.399,0,0.751,0.15,1.051,0.451c0.301,0.301,0.447,0.648,0.447,1.047v25.504L12.001,21.6V3
    c0-0.399-0.15-0.751-0.451-1.051c-0.3-0.297-0.647-0.451-1.051-0.451H7.5C7.5,0.502,7.899,0,8.697,0H15z"/>
  </symbol>
</svg>

Thanks

Most helpful comment

Yep, symbol isn't rendered and since there is no reference to it, it's being removed. You need to disable removeUselessDefs plugin.

All 6 comments

Yep, symbol isn't rendered and since there is no reference to it, it's being removed. You need to disable removeUselessDefs plugin.

Thank you for answering.

I tried running $ svgo --disable=removeUselessDefs svg.svg with the same result.

removeUselessDefs doesn't even show up when I run svgo --show-plugins.

svgo -v
0.5.6

Edit: Nevermind, it worked. However, it's strange the plugin doesn't show. Is this expected behaviour?

I see it there right after cleanupIDs and removeRasterImages. Don't you?

Oh wow. I do. Must have had a brain fart or something. Sorry.

I just thought, that it's better to disable cleanupIDs since you're referrencing to these symbols, right? And then items with IDs shouldn't be removed.

Yea, I figured that out. Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

niftylettuce picture niftylettuce  路  4Comments

Roman52 picture Roman52  路  5Comments

mahnunchik picture mahnunchik  路  3Comments

SebKay picture SebKay  路  5Comments

ai picture ai  路  5Comments