- Notifications
You must be signed in to change notification settings - Fork147
Investigate parsel and css-selector-parser for new globalfication.#633
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
I don't think we want to introduce a new CSS parsing dependency (for all users) just for I'm not a fan of this feature. I'd be in favor of deprecating and eventually removing this behavior altogether. It was added ages ago - while svelte-preprocess was still a personal project of kaisermann's rather than an official project under the sveltejs org - and before other tooling was able to support importing CSS files from JS to inject them (unscoped) into the application. Furthermore, in Svelte 5 you'll also be able to wrap everything in If limitations in |
Uh oh!
There was an error while loading.Please reload this page.
This is a draft of refactoring the
globalifySelectorto use a CSS parser rather than a regex to hopefully allow major libraries like Tailwind and DaisyUI to work better with Svelte.I put more details in the
globalfy/README.mdhowever I'll summarize here:parseland it doesn't seem to be able to take a modified AST (or even the original) and convert it back into a valid CSS selector.css-selector-parserseems to work much better.:global()operator (e.g., fordiv > pwe do:global(div) > :global(p)rather than:global(div > p). The latter is more performant because you can avoid traversing deeper into the AST.css-selector-parserfor some reason? Or prefer another CSS parser?My main goal for opening this PR in draft is to get feedback on if there is any likelihood this could get merged and, since it's a fairly significant change, if the maintainers of this project want to push me in a particular direction or otherwise provide feedback.
Thanks
This is also related to and would probablyfix#501. Though if the maintainers are OK with it I would prefer the quick and dirty#632 get merged to fix that since it's ready to go and simpler. It at least gets Tailwind to work property, however DaisyUI still doesn't work, and that's what this PR is all about.