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
feat(vite)!: svelte-scoped automatic compilation #1692
Conversation
…velte-scoped mode
…Code extension as well
…into scoped-compilation
…hen coming at the beginning of a shortcut name
@antfu Can you please take another look at this to see if it's good to merge or give advice on what to change? I'd love to help with some of the other SvelteKit related issues like #1774 as well as dig into further explorations of how to smoothly integrate the Inspector and typography plugin in a context where a global stylesheet is not the default place to put all styles. But I think this PR is already big enough. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome, thank you!
return prettier(transformed, { | ||
parser: 'svelte', | ||
plugins: [prettierSvelte], | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@antfu, wow, thank you for this! So much easier to read the test results. Initially I tried prettierCSS
as seen elsewhere but obviously that didn't work since there's more than CSS in the test results.
Closes #1676
I've written test cases for every situation described in #1676 and a few less common ones as well. As can be seen by running the tests and the updated
svelte-scoped
example project, theSvelteScopedPlugin
is now fully ready for use in exactly the same manner as is available using global styles, except that each component carries the weight of its own CSS.Merging this will prepare the way for #1718.