codefeathers / rollup-plugin-svelte-svg

Import SVG files as Svelte Components
MIT License
75 stars 13 forks source link

Is it possible to load SVG by symbol ID? #13

Closed gintsgints closed 3 years ago

gintsgints commented 3 years ago

I have next SVG file:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg>
....
    <symbol
       id="symbol13926">
      <path
         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.06667"
         sodipodi:nodetypes="ccccccccccccccccccc"
         d="m 143.80071,144.00126 2.55008,-1.99308 c 2.21312,3.82972 4.68822,6.35216 8.47449,5.91916 5.68072,-0.4148 8.03456,-6.7432 6.84605,-11.51152 -1.14977,-4.27803 -5.85366,-6.36189 -9.59346,-4.08112 -0.84216,0.49131 -1.41733,0.78933 -1.79372,1.04421 -0.40356,-0.69531 -1.34034,-2.46712 -1.34034,-2.46712 l 8.67928,-10.7646 h -9.5225 v 4.56997 h -3.65458 v -8.19995 h 18.61127 v 2.78219 c 0,0 -4.98643,5.49597 -6.63435,8.50584 4.05858,0.15782 7.32994,2.89115 8.50431,7.2125 0.68523,2.27523 0.3781,7.47929 -0.51884,9.72235 -1.49817,3.73896 -5.59038,6.77258 -9.33138,6.94715 -6.28085,0.44834 -9.61284,-4.22779 -11.27631,-7.68598 z"
         id="path17-3"
         inkscape:connector-curvature="0" />
    </symbol>
...
other symbols

Would it be possible to load only one symbol by importing like:

import LetterAcce from './img/NUMBERS_LETTERS_PIPS.svg#symbol13926';
MKRhere commented 3 years ago

Originally considered supporting this use-case, but as has become evident, I don't have time to add features to this plugin. If you fancy so, please make a PR.