Perhaps an alternative syntax to allow binding multiple attributes cleanly? #2
Replies: 2 comments 2 replies
-
|
Hey @radiantshaw, thank you for the kind words 😊 It's good to know that other people see the value in bringing this sort of functionality to Stimulus too. Funnily enough my first few early iterations of StimulusX did use the syntax you propose above - the less adventurous version though! However I switched to the current format for a number reasons:
However to be honest I think that really only argument If it is an optional alternative I guess it would probably make sense to then make that as concise as possible by default. Maybe even just <div sx-hidden="controller#status:is('complete')" sx-class="..."></div>I'd probably want to offer a way for people to customise the attribute name prefix anyway, so people could always override the default if they didn't like it and/or just wanted to change it to a more standard 'data-[...]' attribute name. What do you think? |
Beta Was this translation helpful? Give feedback.
-
|
@radiantshaw I've opened a PR here that implements the style of syntax you proposed as an optional, alternative style of specifying bindings. I've had a play with it and I like it 🙂 If you have a chance to take a look at some point I'd be interested to know what you think. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Big fan of Stimulus and this is a very interesting project I came across in its ecosystem. And congratulations on the release! 🥳
I went through the docs and was thinking of providing an alternate syntax for the binding. One that will help bind more than one attributes in a clean way. I was thinking something like:
Basically, the format would be `data-bind-[attribute]="controller#property:modifier".
Or perhaps, if you're feeling adventurous,
data-x-[attribute].Again. Congratulations on the project. I hope this takes off. ❤️
Beta Was this translation helpful? Give feedback.
All reactions