Skip to content
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

Merged
merged 65 commits into from Oct 25, 2022
Merged

feat(vite)!: svelte-scoped automatic compilation #1692

merged 65 commits into from Oct 25, 2022

Conversation

jacob-8
Copy link
Contributor

@jacob-8 jacob-8 commented Oct 7, 2022

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, the SvelteScopedPlugin 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.

jacob-8 and others added 30 commits October 1, 2022 14:08
@jacob-8 jacob-8 marked this pull request as ready for review October 21, 2022 04:19
@jacob-8
Copy link
Contributor Author

jacob-8 commented Oct 22, 2022

@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.

@antfu antfu requested a review from userquin as a code owner October 25, 2022 05:16
Copy link
Member

@antfu antfu left a 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!

@antfu antfu enabled auto-merge (squash) October 25, 2022 05:20
@antfu antfu merged commit 31c09ff into unocss:main Oct 25, 2022
Comment on lines +31 to +34
return prettier(transformed, {
parser: 'svelte',
plugins: [prettierSvelte],
})
Copy link
Contributor Author

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.

@jacob-8 jacob-8 deleted the scoped-compilation branch January 20, 2023 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ideas for better Svelte Scoped support
2 participants