Using CoffeeScript instead of JS Templates

  • Download Gist
1 2 3 4 5 6 7 8
# Who needs js Templates w/ access to CoffeeScript's string interpolation
# It's not only fast (since CS statically compiles to native JS) but you have the full flexibility of JS
$.getJSON "/grids", null, (e) ->
sb = "<dl>"
sb += "<dd>#{grid.Name}</dd>" for grid in e.Results
sb += "</dl>"
$("#grids .results").html sb

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.