ruby-hyperloop / hyper-react

The project has moved to Hyperstack!!
https://hyperstack.org/
MIT License
285 stars 14 forks source link

Remove HAML class syntax #238

Open sfcgeorge opened 6 years ago

sfcgeorge commented 6 years ago

Looking at the code I also discovered you can use methods to add classes haml style. AKA:

div.green.round { "Hey!" } #=> <div class="green round">Hey!</div>

While excessive metaprogramming in the name of brevity is usually my kind of thing and it's kinda cool, I think this should be removed. It's too unexpected, and the corresponding haml id syntax isn't supported because it would be a Ruby syntax error: div#my_id.my_class {} is not ok.

I imagine it complicates the implementation too, and doesn't even work properly with the all caps recommended element style: div.foo {} works, Div.foo {} works (why is this even a thing), DIV.foo {} doesn't work.

catmando commented 6 years ago

I agree its just sort of 63.28% haml, leaving you frustrated for more, or wishing you had never tried it out.

sfcgeorge commented 6 years ago

Classes don't even work as you'd expect. If there are dashes in the class you have to use _ but then if there are underscores you have to use __ which is weird and seems like the wrong way round and I just bet someone will spend hours wondering why their .foo_bar class isn't working because they didn't spot it subtly changed to foo-bar

DIV.blue_text {} #=> <div class="blue-text">
DIV.blue__text {} #=> <div class="blue_text">