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

Problems with Sketch #45

Closed
gisu opened this issue Jul 10, 2014 · 2 comments
Closed

Problems with Sketch #45

gisu opened this issue Jul 10, 2014 · 2 comments

Comments

@gisu
Copy link

gisu commented Jul 10, 2014

Maybe a Problem with SVGs from Sketch3. When i combine SVGs with SVGStore i get an invalid SVG Sprite. Combined the same Icons with grunt-svg-sprite the Sprite is valid.

For the test i didn't use SVG Min.

Combined SVG 1

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="327px" height="327px" viewBox="0 0 327 327" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
    <!-- Generator: Sketch 3.0.3 (7892) - http://www.bohemiancoding.com/sketch -->
    <title>Slice 1</title>
    <desc>Created with Sketch.</desc>
    <defs></defs>
    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
        <path d="M163.5,327 C253.798557,327 327,253.798557 327,163.5 C327,73.2014434 253.798557,0 163.5,0 C73.2014434,0 0,73.2014434 0,163.5 C0,253.798557 73.2014434,327 163.5,327 Z M101.5,145 C118.89697,145 133,130.89697 133,113.5 C133,96.1030304 118.89697,82 101.5,82 C84.1030304,82 70,96.1030304 70,113.5 C70,130.89697 84.1030304,145 101.5,145 Z M224.5,145 C241.89697,145 256,130.89697 256,113.5 C256,96.1030304 241.89697,82 224.5,82 C207.10303,82 193,96.1030304 193,113.5 C193,130.89697 207.10303,145 224.5,145 Z M163.5,287 C216.795478,287 260,265.509668 260,239 C260,212.490332 216.795478,191 163.5,191 C110.204522,191 67,212.490332 67,239 C67,265.509668 110.204522,287 163.5,287 Z" id="Oval-1" fill="#D8D8D8" sketch:type="MSShapeGroup"></path>
    </g>
</svg>

Combined SVG 2

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="538px" height="429px" viewBox="0 0 538 429" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
    <!-- Generator: Sketch 3.0.3 (7892) - http://www.bohemiancoding.com/sketch -->
    <title>Rectangle 1</title>
    <desc>Created with Sketch.</desc>
    <defs></defs>
    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
        <path d="M463.418769,116 L531.000924,116 C534.874254,116 538,119.131711 538,122.994873 L538,422.005127 C538,425.864082 534.866407,429 531.000924,429 L6.9990758,429 C3.12574632,429 0,425.868289 0,422.005127 L0,122.994873 C0,119.135918 3.13359297,116 6.9990758,116 L73.407817,116 L106.357259,8.61307007 C107.817263,3.85470854 113.027611,0 117.99592,0 L414.00408,0 C418.972653,0 424.326925,3.80821248 425.963769,8.50588065 L463.418769,116 L463.418769,116 Z M269.5,409 C347.096007,409 410,346.096007 410,268.5 C410,190.903993 347.096007,128 269.5,128 C191.903993,128 129,190.903993 129,268.5 C129,346.096007 191.903993,409 269.5,409 Z M269.5,383 C332.736604,383 384,331.736604 384,268.5 C384,205.263396 332.736604,154 269.5,154 C206.263396,154 155,205.263396 155,268.5 C155,331.736604 206.263396,383 269.5,383 Z" id="Rectangle-1" fill="#D8D8D8" sketch:type="MSShapeGroup"></path>
    </g>
</svg>

Result

<svg viewBox="0 0 100 100"><symbol viewBox="0 0 538 429" id="bcam"><title>Rectangle 1</title><desc>Created with Sketch.</desc> <!-- Generator: Sketch 3.0.3 (7892) - http://www.bohemiancoding.com/sketch -->    <g id="svgstore6b7b9ce14f55c0e5a5968e00977f20eePage-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"> <path d="M463.418769,116 L531.000924,116 C534.874254,116 538,119.131711 538,122.994873 L538,422.005127 C538,425.864082 534.866407,429 531.000924,429 L6.9990758,429 C3.12574632,429 0,425.868289 0,422.005127 L0,122.994873 C0,119.135918 3.13359297,116 6.9990758,116 L73.407817,116 L106.357259,8.61307007 C107.817263,3.85470854 113.027611,0 117.99592,0 L414.00408,0 C418.972653,0 424.326925,3.80821248 425.963769,8.50588065 L463.418769,116 L463.418769,116 Z M269.5,409 C347.096007,409 410,346.096007 410,268.5 C410,190.903993 347.096007,128 269.5,128 C191.903993,128 129,190.903993 129,268.5 C129,346.096007 191.903993,409 269.5,409 Z M269.5,383 C332.736604,383 384,331.736604 384,268.5 C384,205.263396 332.736604,154 269.5,154 C206.263396,154 155,205.263396 155,268.5 C155,331.736604 206.263396,383 269.5,383 Z" id="svgstore6b7b9ce14f55c0e5a5968e00977f20eeRectangle-1" fill="#D8D8D8" sketch:type="MSShapeGroup"/> </g> </symbol><symbol viewBox="0 0 327 327" id="bsmilie"><title>Slice 1</title><desc>Created with Sketch.</desc> <!-- Generator: Sketch 3.0.3 (7892) - http://www.bohemiancoding.com/sketch -->    <g id="svgstore484675889306b2e1d6971a57964bf9afPage-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"> <path d="M163.5,327 C253.798557,327 327,253.798557 327,163.5 C327,73.2014434 253.798557,0 163.5,0 C73.2014434,0 0,73.2014434 0,163.5 C0,253.798557 73.2014434,327 163.5,327 Z M101.5,145 C118.89697,145 133,130.89697 133,113.5 C133,96.1030304 118.89697,82 101.5,82 C84.1030304,82 70,96.1030304 70,113.5 C70,130.89697 84.1030304,145 101.5,145 Z M224.5,145 C241.89697,145 256,130.89697 256,113.5 C256,96.1030304 241.89697,82 224.5,82 C207.10303,82 193,96.1030304 193,113.5 C193,130.89697 207.10303,145 224.5,145 Z M163.5,287 C216.795478,287 260,265.509668 260,239 C260,212.490332 216.795478,191 163.5,191 C110.204522,191 67,212.490332 67,239 C67,265.509668 110.204522,287 163.5,287 Z" id="svgstore484675889306b2e1d6971a57964bf9afOval-1" fill="#D8D8D8" sketch:type="MSShapeGroup"/> </g> </symbol></svg>
@djmadeira
Copy link

The reason the sprite is invalid is because it removes sketch's namespace declaration: xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"

To confirm, put the output in the W3C validator with the MIME type SVG 1.1. Not sure how the plugin should handle this; should it put the namespace attribute in the <symbol> or the root <svg>?

There's no option in sketch to remove these on export unfortunately, so it looks like this would be a good problem for the plugin to solve.

@FWeinb
Copy link
Owner

FWeinb commented Jul 10, 2014

See #25. I think I need to put it in the readme.

@FWeinb FWeinb closed this as completed Jul 10, 2014
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

3 participants