Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1692

SvelteKit: SVG on HTML page, or as standalone SVG file depending on route

$
0
0

I have a component, image.svelte which renders an SVG file. On one route, say /image, I want a page that includes that component rendered within an HTML document. But if you go to /image.svg, I want just the SVG document by itself and I want the page to be served with Content-Type: image/svg+xml.

I started by making creating a file like src/routes/image[ext]/+page.svelte, but there doesn't seem to be a way to break out of src/app.html.

Next I tried making two files, src/routes/image/+page.svelte and src/routes/image.svg/+server.js, but it doesn't seem to be possible to render components directly from a server-side script in SvelteKit.

So I'm at a loss and haven't find what I'm looking for in the docs.


Viewing all articles
Browse latest Browse all 1692

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>