-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Multiple preprocessors, doesn't get parsed content from previous preprocessor #4141
Comments
Hi, so there's actually Markup plugins are run first (which is what svelte-image is), regardless of the order in the array. Bah! Nevermind about the space in the file... this stupid laptop keyboard causes cursor to jump all over the place and I inserted the space in the config file 🤦♂️ |
Oh, and The fork you're using is abandoned and really didn't do anything special. |
Thank you for your quick response, @dkondrad! And thanks for the tip about using svelte-preprocess-sass instead, I've exchanged it in my example repo. But the core problem remains: how would one combine a style preprocessor with a markup preprocessor? If the markup always runs first it will try to parse Svelte code that isn't valid. Wouldn't it make more sense for Svelte to simply run the preprocessors in the order we provide? Does anyone know of a workaround to use both svelte-preprocess-sass and svelte-image? |
The markup processors in general need to run first, because if your component is written in Pug or something, there won't even be |
I kept discussing this issue with matyunya, author of svelte-image, and we thought it would be cool to be able to fully set the order of preprocessors when passing them to rollup-plugin-svelte. He wrote a fixed version of rollup-plugin-svelte (https://github.com/matyunya/rollup-plugin-svelte) where you can pass The prop orderPreprocessors should maybe be renamed to something more suitable, but this should definitely be applied to rollup-plugin-svelte. Hope it can get merged. For now I'll be using matyunya's fork. EDIT: The example repo (https://github.com/atwoodhouse/example-svelte-multiple-preprocessors) is updated to use matyunya's fork of rollup-plugin-svelte, if anyone wants to see it work in action. |
@atwoodhouse the order of preprocessor is sorted, you can refer to the docs https://svelte.dev/docs#svelte_preprocess |
Yes, that's what I meant with that the option "orderPreprocessors" is a bit counter-intuitive and should be renamed. The purpose is to tell rollup-plugin-svelte not to reorder the preprocessors. What we want to achieve is the possibility to not sort the order of the preprocessors but let the user (ie coder) set the exact order that the preprocessors will be applied. So that it's possible to first run a style preprocessor and then run a markup preprocessor afterwards. See PR 86 for rollup-plugin-svelte: sveltejs/rollup-plugin-svelte#86 |
Thanks for an amazing framework that surely will take over the world in the years to come!
I'm writing my first Svelte (Sapper) project and want to use two great preprocessors combined:
In my rollup.config.js I've defined the preprocess pipeline as such:
svelte-image uses svelte.process() to parse the content, but fails to do so because unparsed scss remains in the content it receives, even though it's after the scss preprocessor in the pipeline.
Have I misunderstood how the Svelte preprocessor pipeline should be defined, or is this a bug in Svelte?
Here's a minimal example of the issue: https://github.com/atwoodhouse/example-svelte-multiple-preprocessors
The text was updated successfully, but these errors were encountered: