from Hacker News

Coffeekup

by franckcuny on 7/4/11, 11:45 AM with 66 comments

  • by mikemaccana on 7/4/11, 12:52 PM

    I love CoffeeScript but I don't understand this. HTML / HAML / SHPAML are document languages. CoffeeScript is a programming language.

    An element that contains another element isn't a function. I don't see any reason to make it one.

    If you want a templating language, why not use one, rather than having an unnecessary 'space dash greater than' to indicate elements are contained within each other?

  • by nzoschke on 7/4/11, 12:30 PM

    Cute name and well executed project.

    But personally, Coffeescript -> Javascript -> HTML sounds way too indirect for my taste.

    I've seen this patter a few too many times at work now: the new frontend guy loves HAML, and he uses it on a project, and the next couple guys that help maintain it hate it and rewrite everything in straight up HTML.

  • by alecbenzer on 7/4/11, 2:19 PM

    While I agree that it does seem slightly more appropriate to use something like haml that's specifically designed for this purpose, I kind of like this because it removes the somewhat annoying need to learn a new language (assuming you already know coffescript).

    I haven't looked at this too much, but I also find that templating languages often try to implement some elements of higher level programming languages, but often end up not having some of the features I want (I'm thinking specifically about liquid right now and it's apparent inability to let the designer declare arrays on their own, and its sort of awkward "filter" mechanism instead of just sticking to function calls, syntactically)

    edit: well, actually, nevermind - now that I think about it liquid and haml/erb/etc are different things - liquid is trying to be a programming language and haml/erb are templating markups used with existing programming languages. I guess what I like about this is that it's just one consistent language - the markup parts and the dynamic parts are done via the same thing, as opposed to having a programming language embedded in a markup language

  • by etaty on 7/4/11, 2:25 PM

    I prefer http://jade-lang.com/ why ? because no '->' at the end of each line
  • by coenhyde on 7/4/11, 12:54 PM

    Looks fantastic.

    With the traction Coffeescript is getting I wouldn't be surprised to see it eventually execute directly inside v8 or similar, bypassing the javascript compilation altogether.

  • by lysol on 7/4/11, 1:00 PM

    I sort of like the idea, but think I'd rather just have a CoffeeScript version of EJS. It's hell on my shift key but I still _like_ HTML as it is, after all these years.
  • by tptacek on 7/4/11, 5:21 PM

    Just looking at the syntax and thinking about how I would write things in it, this looks strictly inferior to Haml; there's syntax in here that appears to exist solely to shoehorn this into Coffeescript's grammar. What does this do better than Haml to make up for that?
  • by wallrat on 7/4/11, 12:12 PM

    Looks pragmatic and useful. I've been experimenting with a similar implementation inspired by Clojure's Hiccup, but Coffekup looks mature enough to consider adopting.
  • by jedschmidt on 7/4/11, 7:05 PM

    This exploits CoffeeScript syntax in the same way that (fab) exploits JavaScript syntax:

    https://github.com/jed/fab/blob/browser/demo.html

    (I'm biased, but am a fan of making markup "just code".)

  • by johnlaudun on 7/4/11, 12:47 PM

    I like the thinking that go into efforts such as this, but like other commenters I do on occasion end up wondering about the fragmentation that this leads to. That worry noted, the thinking is the important point and CoffeeKup is very cool.
  • by mtogo on 7/5/11, 3:11 PM

    I have no idea what this is. Shows up as two large empty text boxes under Opera.

    After opening it in Firefox, i find it ironic that something that has to do with web standards is so broken in a major browser.

  • by chetan51 on 7/4/11, 8:42 PM

    Looks interesting. A suggestion: there's no example anywhere for something like

      <div class="content">
    
    Please add that to the example on the landing page.
  • by emehrkay on 7/4/11, 3:33 PM

    This may be a bit "get off of my lawn," but I would never use this. I respect the effort put into making it work, but I have no problem writing <div></div>
  • by denysonique on 7/5/11, 12:06 AM

    This is wonderful. I am looking forward to someone creating a Coffeekup Gem. I will use this in my next Rails project. Thank you for this awesomeness.
  • by anonymous on 7/4/11, 8:26 PM

    What a great idea! Now i can write html that nobody understands but me. This will keep those pesky designers from messing with my codes.
  • by shimonamit on 7/4/11, 1:44 PM

    I just noticed the example is editable! Thumbs up for a great demonstration.
  • by zentechen on 7/4/11, 11:55 PM

    This is so stupid.
  • by chrisjsmith on 7/4/11, 12:33 PM

    Whilst I appreciate the effort that people put into these things, I really don't like this sudden obsession of adding another layer of abstraction over everything. Abstrations are hard to debug, require a learning curve of 2x the original problem and are rarely complete.