4 ms·
I also stopped using RJS once I switched to JQuery. I however haven't moved to HAML just yet. Something makes me nervous about not working with raw HTML (espe
by marknutter 17y ago
I also stopped using RJS once I switched to JQuery. I however haven't moved to HAML just yet. Something makes me nervous about not working with raw HTML (especially with all the non-rails front-end development work I do). Why is HAML + JQ an amazing combination and am I really missing out on something here?
- jshen 17y agothey have a very similar syntax, and haml reduces line noise of plain html.
- tptacek 17y agoBecause most of the day-to-day things you do in jQuery involve doing something special with an element by id or class, and Haml's syntax for special classes and id's is painless. For instance: %a.post_link.confirm_link.destructive_link{link_to(@x)} Hi mom I'm probably not selling it very well. But basically, you know the old DOM tutorials that talk about how you can do you own tags like: <box name="foo"> <item number="1" /> <item number="2" /> </box> and then convert it to <div class="box" id="foo"> <div clas="item" id="item_1" /> <div clas="item" id="item_2" /> </div> or whatever; in Haml, that's just: .box#foo .item#item_1 .item#item_2
- marknutter 17y agoIn some ways I can really see the readability gains - haml is very succinct and neat. But there's a cost involved, namely getting my eyes and brain to comfortably recognize new syntax and patterns, something that for me usually takes a long time. I also worry about creating something in HAML and having people not familiar with it not be able to dive into the project and start working right away. I'm actually on the other side of that scenario right now and it's a pain. But I do have to admit, it's a very pleasing syntax.
- tptacek 17y agoIt's not even readability that makes it a win; it's that the combination of jQ and Haml is like working in a markup language that has native support for every widget or UI flourish you could want.
- marknutter 17y agoVery intriguing. Hmm.