Skip to content

feature request: Source Maps #6

Closed
wmhilton opened this Issue Dec 16, 2013 · 4 comments

3 participants

@wmhilton

How hard would it be to support source maps for CoffeeScript files? I tried simply adding sourceMap: on to the compileOptions, but that didn't work. I'm a little worried that it will be difficult to add, since it would require writing out multiple files (the JavaScript, the original CoffeeScript, and a Map). But it would make my life much easier trying to debug!

@RobLoach
DocPad member

Looks like we'd need another compilation process to render the source map, and output the additional .map file:
https://github.com/jashkenas/coffee-script/blob/master/lib/coffee-script/coffee-script.js#L81

Would be interesting to add some of this to the UglifyJS plugin as well:
https://github.com/mishoo/UglifyJS2#source-map-options

@dominics

Code attached, although it uses data-urls to avoid a second compilation pass, so there's room for some improvement; perhaps an option to output separate .map files, but we'd need a clear way to be able to produce multiple output files from one input document - including the original coffeescript source, otherwise there's not much point to sourcemaps!

@dominics
dominics commented Apr 4, 2014

I've just merged the sourcemaps support and published master as v2.4.0. Give it a try! 👍

@dominics dominics closed this Apr 4, 2014
@wmhilton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.