sveltejs / svelte-preprocess

A ✨ magical ✨ Svelte preprocessor with sensible defaults and support for: PostCSS, SCSS, Less, Stylus, Coffeescript, TypeScript, Pug and much more.
MIT License
1.76k stars 151 forks source link

Added example for alias importer #531

Closed Hecatron closed 2 years ago

Hecatron commented 2 years ago

Hi, I've added an example of using the importer callback within svelte-preprocess. I was inspired to write it based on the example here - https://github.com/sveltejs/svelte-preprocess/issues/97

This solved a problem for me when trying to get vite alias's working inside the svele:head section of a component It took me a while to figure out so I thought it might be worth documenting.

dummdidumm commented 2 years ago

Wow, that's a very thorough and good explanation of what to do - thank you! Some of these things feel a little unrelated to svelte-preprocess (mentioning the Vite options), but I also don't know whereelse the best place is to put this. Ultimately this feels like something that belongs into a section of guidelines on the SvelteKit site, which doesn't exist yet, so this or a blog post on something like dev.to may be the next best place in the meantime.

bluwy commented 2 years ago

I also think it's better if this is published as a blog. It should be more easily indexed by search engines too. It's very specific to a usecase which I'm not sure fit in the general documentation.

Hecatron commented 2 years ago

Ok I'll post this as part of a blog entry once I get my blog up and running