jashkenas/coffee-script — Issue #1792: "bare" attribute for type="text/coffeescript" script tags
Author: mahemoff
Created: 2011-10-22 09:44:40+00:00
State: open

There are situations where bare compilation (equivalent to --bare, ie no closure) would be useful, so I'd propose an extra attribute on the script tag:

... where "bare" of course defaults to false.

A typical case is JSONP, where various frameworks auto-generate a local-scoped function. On such framework is Google's Ajax Feed API. Here's an example of a CoffeeScript which fails normally, but works with bare compilation:

CoffeeScript:
google.load 'feeds', '1'
init = () ->
console.log 'Yes it worked!'
google.setOnLoadCallback init

HTML: