Live data from Hacker News

jashkenas.github.com

1–10 of 11 posts

Re: <script type="text/coffeescript">

#4
post #2

http://news.ycombinator.com/item?id=1014080

I think the OP was pointing out that you can now use CoffeeScript in tags.

I did something like this for Objective-J awhile back, but it's not particularly useful (http://github.com/tlrobinson/cappuccino-experiments/blob/mas...)

Re: <script type="text/coffeescript">

#6
post #2

http://news.ycombinator.com/item?id=1014080

I think the OP was pointing out that you can now use CoffeeScript in tags. I did something like this for Objective-J awhile back, but it's not particularly useful ( http://github.com/tlrobinson/cappuccino-experiments/blob/mas... )

Yep, it's not particularly useful -- there's no case I can think of where you wouldn't be better off compiling your scripts to JavaScript first.

But if you just want to play with it, or prototype a web page, it's fun for that.

Re: <script type="text/coffeescript">

#8
The gist of it is this. If you include the minified version of the CoffeeScript compiler on a webpage (43k, gzipped), it will compile and evaluate the inline coffeescripts on the page. That documentation site uses it to hook up the menu and the "Try CoffeeScript" demonstration in the toolbar.

If you view source, you'll see something along these lines:

    

      window.repl_run: ->
        try
          eval window.compiled_js
        catch error then alert error

      close_menus: ->
        current_nav.removeClass 'active' if current_nav
        current_nav: null

      $(document.body).click -> close_menus()

    
Post reply on HN