shakyShane / gulp-svg-sprites

Create SVG sprites or compile to <symbols>
MIT License
334 stars 45 forks source link

Strips out feDropShadow #103

Open jlafitte opened 7 years ago

jlafitte commented 7 years ago

For some reason the output is striping the filter definition I'm trying to use. Here is what I'm trying in the sources SVG:

  <defs>
    <filter id="shadow">
      <feDropShadow dx="4" dy="8" stdDeviation="4"/>
    </filter>
  </defs>
  <circle cx="29" cy="29" r="29" style="fill:#0091ca; filter:url(#shadow)"/>

But what gets created is this:

  <defs>
    <filter id="a"></filter>
  </defs>
  <circle cx="29" cy="29" r="29" fill="#0091ca" filter="url(#a)"></circle>
tomash-als commented 7 years ago

feDropShadow primitive isn't a part of SVG 1.1 spec, so SVGO removes it. Try to disable removeUnknownsAndDefaults SVGO plugin in config:

svgSprite({
    cleanconfig: {
        plugins: [{removeUnknownsAndDefaults: false}]
    }
})

But be careful: all other unknowns will not be removed too

ciases commented 6 years ago

Better use cleanupIDs: false in this case.