HTML5 Zone is brought to you in partnership with:

Chris Smith writes coffeescriptlove.com, a fan blog dedicated to that devastatingly elegant "little language that compiles into JavaScript." He loves programming, and software development in general, with a career arc that traces the ascendance of Java, then that of Ruby on Rails, and is now aligning with the power and possibilities of today's browser technologies. He is currently writing an interactive ebook on Backbone.js and CoffeeScript (backbonecoffeescript.com). Chris is a DZone MVB and is not an employee of DZone and has posted 18 posts at DZone. You can read more from them at their website. View Full User Profile

Source Maps for CoffeeScript

04.07.2012
| 4736 views |
  • submit to reddit
One of the more serious concerns about CoffeeScript is that it lacks a first-class debugging environment. The code that you see in a browser debugger is the compiled JavaScript, not the CoffeeScript source. Thanks to JavaScript Source Maps, however, this long-running issue will likely be solved in the very near future.

JavaScript Source Maps is a system of references from JavaScript executing in the browser to original source files that have been minified, concatenated, compiled, or otherwise transformed. Chrome dev tools evangelist Paul Irish called Source Maps "the biggest thing to happen to JavaScript debugging in years." The Google Chrome team is pushing aggressively toward the release of Source Maps support (you can preview the feature in Chrome Canary).
You can read more about Source Maps in MozillaWiki feature page, in this tutorial, and in the formal proposal co-authored by Mozilla and Google. There is a Source map support plan discussion on the CoffeeScript Google Group.

Finally, Mozilla intern Nick Fitzgerald has produced a great what-I-did-this-summer video explaining the importance of Source Maps and of languages such as CoffeeScript. I recommend watching all 15 minutes of it, but for the TL;DR crowd, start around minute 11 for the sequence in which he demos an actual JavaScript console error with a link back to CoffeeScript source. Woo Hoo!
Published at DZone with permission of Chris Smith, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)