-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Apply CSS scoping classes directly to AST (WIP) #1228
Conversation
Also it would be nice to make the CSS ref attribute into a class. That should theoretically not be too bad if we're modifying the AST instead of adding special cases to the rendering. |
Nice, this is definitely cleaner.
Maybe a good way to do this would for the That would eliminate the need for I think we play a bit fast and loose with bare attributes. For string attributes (as opposed to boolean attributes), it means the empty string rather than Agree re ref attribute, I reckon that'd be better. |
I like the idea of the Edit: Whoops, you said in your comment already where you think it should go. Reading can save time ... Edit again: Right after Edit again again: Okay it looks like putting |
figured it out — |
ok, looks like we're set. will merge this to close #1223, and open a separate issue for refs-as-classes |
(Based on the #1223 branch to also get its unit test.)
A couple of issues still remain here:
unused-selector-ternary
test becauseattributeMatches
bails whenattr.value.length > 1
, which it now is, because there's the ternary part and thesvelte-xyz
class part. Not sure how to best handle this. Would it be practical to make the AST modifications after all theSelector#apply
stuff?Element#addCssClass
logic could use some more thought. I'm not sure how to handle when the class attribute'svalue
istrue
(this would mean that there is a bareclass
attribute, what the heck do we do with that?); and TypeScript is also still complaining aboutclassAttribute.value.length
, not sure whether it needs appeasing there or what.