4 ms·
At Circle, we write all our front-end code in Coffeescript, and all our front-end templates in Haml-coffee (https://github.com/netzpirat/haml-coffee https://git
by pbiggar 14y ago
At Circle, we write all our front-end code in Coffeescript, and all our front-end templates in Haml-coffee (https://github.com/netzpirat/haml-coffee https://github.com/netzpirat/haml-coffee). I thoroughly recommend Hamlcoffee - its mature and reliable, and is basically HAML but with coffeescript instead of Ruby.
So looking at this for how it compares to Hamlcoffee.
- I dont like the arrows (we already have indentation, so it feels like the arrows are wasteful)
- I do like the `or` syntax (@title or "Untitled). THat said, I don't know if I'd use it and I suspect there's a way in Hamlcoffee, but I've never needed it.
- I cant read this at all: `(li -> a href: '/', -> 'Home')`. I feel it is a lot less readable than pure coffee, and much worse than hamlcoffee.
- In the github page, they say coffeekup might not be great if "You use divs and/or classes for everything". I could be mistaken, but doesn't everybody do that? Is it just me?
- Haml's biggest annoyance is trying to get commas and full-stops in. I don't see discussed whether that is easy here.
- mntmn 14y agoRegarding 1: Yes, that's not perfect. But in HAML you have to mark the beginnings of your lines with %, - or = and such, so that's the tradeoff. 2: That's just a feature of CoffeeScript. 3: It is pure CoffeeScript. And I agree, it's the same as 1. But the example is also a little odd. a href:'/', 'Home' should work fine. 4: Well, a matter of taste. There is the "semantic html" crowd who try to map the classes of the "div" crowd to more diversified html5 tags, e.g. "section header ul li span" instead of "div div div div" with different classes. I tend to mix both approaches. HAML has the . syntax for the div-inclined, which is nice. 5: No such problems here. But you have to deal with all the arrows ;)
- mntmn 14y agoAfter digging through the discussion and links and this comparison, and if I had to choose something for a new project today, I might take a really serious look at Jade, though. No arrows, no percents, and very thorough discussion of the features (and the compiled output) on its github page.
- pbiggar 14y ago1. I quite like "%" - it nicely marks tags as what they are (and its at the start of the line, not the end). Then there's '.', '-' and '=', which have different semantics so you always know what you're looking at. Its much worse at the end of the line, and 2 chars is unpleasant :) 3. I guess its a part of coffee I steer clear of (and a part of ruby I avoid). Once you have 2 or 3 names in a row, its awkward to decode the function call ordering, so I just avoid it. Actually, I think that that's what I don't like about this. In haml, its a declarative syntax, and that's very restrictive (in a good way). In coffeekup, its pure coffeescript, which means you have imperative semantics that can do anything, and so need to be decoded. But maybe its not a problem in real-life, but if that example is indicative, I'm happy where I am.