Closed notramo closed 1 year ago
I'm not sure I exactly understand, can you explain a little more? What kind of file is this, another svelte template or something else? What's generating the filename (Plenti or a 3rd party script?) and where is it getting written to on the filesystem?
There are lot of SVG icons imported. For ease of use, I want to create an icon.svelte
component, with name
being passed as property. The component would look up the filename, read the file content, then inline it. The difficulty is that the pre-rendering can not use fetch
, and browser environment doesn't have filesystem I/O.
Ah yes, I've wanted to do something similar for Tabler Icons, but it's harder to import SVGs in Svelte than I thought. I ended up doing this:
Then I uploaded all the Tabler SVGs to a layouts/tabler_icons/
folder.
I also ran 4 bash scripts to prep the icons so I could target them and override their properties:
Closing this for now, just let me know if you'd like to discuss more.
Is it possible to inline a file, with a programmatically generated filename?
import
doesn't work because it only works with literals as filename.