Investigate parsel and css-selector-parser for new globalfication. #633
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a draft of refactoring the
globalifySelector
to 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.md
however I'll summarize here:parsel
and 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-parser
seems to work much better.:global()
operator (e.g., fordiv > p
we 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-parser
for 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 probably fix #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.