Closed rflmyk closed 9 years ago
Did it suddenly break without any changes to files or configuration?
Not, see sample: I save a svg file in the Illustrator named facebook.svg
and put in folder together others files ***.svg
, then I run task grunt sprite-svg
when return to message.
Ok - so you added a new file. What does the svg source of it look like?
Yes, if I add one file in folder with name any the terminal print
Running "svg-sprites:create" (svg-sprites) task
Building SVG sprites...
Fatal error: Cannot read property 'x' of null
Would you mind posting a little more info here - like the name and svg-source of the file. It's hard to tell much from the error message alone.
Yes, follow: task
'dr-svg-sprites': {
create : {
options: {
spriteElementPath: 'assets/imgs/svg/',
spritePath: 'assets/imgs/sprite/sprite.svg',
cssPath: 'assets/css/sass/objects/_icons.scss',
layout: 'packed', //packed , horizontal , vertical , diagonal
prefix: 'icons'
}
}
}, // svg-sprites
images names:
sample of names that give error:
plus-faq.svg
menu-categorias-inactive.svg
The source code plus-faq.svg:
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.2, 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">
<svg version="1.1"
id="svg2" sodipodi:docname="plus-faq.svg" inkscape:version="0.48.4 r9939" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="8px" height="8px"
viewBox="0 0 8 8" enable-background="new 0 0 8 8" xml:space="preserve">
<sodipodi:namedview id="namedview8" inkscape:window-height="480" inkscape:window-width="640" inkscape:pageshadow="2" inkscape:pageopacity="0" pagecolor="#ffffff" bordercolor="#666666" showgrid="false" guidetolerance="10" inkscape:cy="4" gridtolerance="10" inkscape:cx="4" objecttolerance="10" inkscape:zoom="29.5" borderopacity="1" inkscape:window-maximized="0" inkscape:current-layer="svg2" inkscape:window-y="0" inkscape:window-x="0">
</sodipodi:namedview>
<polygon id="polygon6" fill="#FFFFFF" points="5,0 3,0 3,3 0,3 0,5 3,5 3,8 5,8 5,5 8,5 8,3 5,3 "/>
</svg>
Thanks for posting info ;)
I see you used packed
for layout - there was an issue fairly recently that may have been triggered by this: https://github.com/drdk/grunt-dr-svg-sprites/issues/36
Reviewing it I see it also gave the error message you encountered. We didn't find the actual bug - it was difficult to reproduce - but switching to another layout seemed to help.
I'm not sure if this is would work given the number of sprite items you have - but it might work?
Very nice! That was it, thanks for help me! Other error that me happened was
Fatal error: Inappropriately located doctype declaration
, got it solve simply replaced
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
]>
for:
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
Till more ;)
Any news on this layout: packed
issue?
Sadly - no. But I should probably close this one and make a new issue on it.
Created a new one https://github.com/drdk/grunt-dr-svg-sprites/issues/46
Good morning, I do not know why there are some svg's that give the error :
Fatal error: Cannot read property 'x' of null
when I run tasksvg-sprites
, someone know why ?