-
Notifications
You must be signed in to change notification settings - Fork 52
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
Pass class and id via shorthand in $ #81
Comments
This seems specific to the web DOM, so I think this would be a good addition to the |
There's an implementation of this in https://git.sr.ht/~severeoverfl0w/helix-sev |
Very nice! Question: ($d :div.foo.bar {& {:class "baz"}} ,,,) based on my read of your code as-is, the dynamic prop (react/createElement "div" (merge-props #js {:class "foo bar"} {:class "baz"}) ,,,) It's not clear to me what the correct behavior is here. what do you think? |
@lilactown You're right, that's a limitation right now. It has that limitation because I didn't think it was possible to implement things such that this limitation wouldn't exist. I think there're two behaviours here that make sense:
If |
I propose that
$
support the following:($ "div.foo.bar#unique#id" {} …)
where{:class ["foo" "bar"] :id "unique id"}
would be set as a result of this.Many hiccup-inspired tools utilize this kind of syntax, for example Reagent. The shorthand makes it a lot easier to sell a team on Helix that is currently using something with "less typing".
We've been using a $-wrapping macro at work since using Helix (~6 months at least) and have not found any downsides yet. Our code is definitely shorter! :)
The text was updated successfully, but these errors were encountered: