Skip to content

Comment on <script type="text/coffeescript">

Comments

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:

    <script type="text/coffeescript">

      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()

    </script>
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.