jkphl / grunt-iconizr

SVG + PNG icon kit generator — Grunt plugin wrapping around node-iconizr that creates a CSS icon kit from a bunch of SVG files, serving them as SVG / PNG sprites or embedded data URIs along with suitable CSS / Sass / LESS / Stylus etc. stylesheet resources and a JavaScript loader for easy integration into your HTML documents
http://iconizr.com
MIT License
104 stars 9 forks source link

Error: Start tag expected on Adobe Illustrator SVG files. #20

Closed augbog closed 9 years ago

augbog commented 10 years ago

I tried running grunt-iconizr on some SVGs a designer was sending me and it throws an unexpected start tag error.

screen shot 2014-11-04 at 11 44 47 am

I believe it's because Adobe Illustrator adds a bunch of XML content.

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"     "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
<!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
<!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
<!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
<!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
<!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
]>
<svg version="1.1" id="Layer_1" xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;"
 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 85.3 85.4"
 enable-background="new 0 0 85.3 85.4" xml:space="preserve">
...

Is there anyway we can get grunt-iconizr to work with this? Or if people have workarounds, maybe I am just doing something wrong. Would love to incorporate this in our workflow. Thanks a bunch.

jkphl commented 10 years ago

Hi @augbog,

without having inspected this further yet (and sorry, I won't have the time for doing so in the next few days) I'd say this is an SVGO issue rather than an iconizr issue. You might try disabling some of the involved SVGO plugins or manual cleaning of the SVG files prior to using them with iconizr. Sorry for not having better pointers right now.

Cheers, Joschi

augbog commented 10 years ago

@jkphl No problem. Just wanted to contribute a possible use case :) I'll let you know if I find a way to clean it up. I also haven't had much time to play around more with this.

jkphl commented 9 years ago

Hi @augbog,

did you ever manage to get this working? I'll start to rewrite iconizr from scratch in the next few days. If you're still interested, you could send me the files in question and I'll see what I can do / say. Besides that, I'll close this issue for now, but please feel free to re-open it in case you still have problems.

Cheers & Happy New Year, Joschi