hyper-react icon indicating copy to clipboard operation
hyper-react copied to clipboard

Remove HAML class syntax

Open sfcgeorge opened this issue 7 years ago • 2 comments

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.

sfcgeorge avatar Jan 17 '18 14:01 sfcgeorge

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

catmando avatar Jan 18 '18 15:01 catmando

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">

sfcgeorge avatar Jan 18 '18 21:01 sfcgeorge