For concatenated/bundled build layers, support source map generation so that a source map-enabled browser could allow debugging of the combined file as separate files for each module.
This should work without minifying, so if optimize: 'none' is in play. Then, also connect that source map bundle with the one uglifyjs2 uses when minifying.
Relates to #397, source map generation for bundled files
I'm confused how is this different than what is already available?
Would this provide multi-stage source maps? So my uglified and concatenated r.js generated file could source map all the way back to my coffeescript?
@dbashford that is the hope. This ticket is for going from separate JS files to bundled files. Uglify can take it from bundled to minified. What is then needed is a way for transpiler plugins to participate, so .coffee to separate JS files. That will likely be worked out at least in part in this ticket for the coffeescript plugin:
This work was done in a branch, and did a local merge without a merge commit, finished up in bdd34e1
This is awesome. Have been looking for this for a while. +100
In case anyone is wondering why we don't use the require-cs plug-in instead of this build process, it's because it breaks our content security policy and we found that compilation times in Firefox and IE were very slow (which dramatically slowed down page load times as the amount of code we wrote increased).
Just updated Mimosa with the latest requirejs and this works like a charm.
Re: the comment above
Uglify supports being passed a source map as input, which makes it easy to go from coffee to js to mangled js while preserving the original map back to the coffee source.
But I'm not sure if it supports being passed N maps for N files that are being bundled together. It may. Not something I've looked into, but was on my short term roadmap to dig through uglify to understand how it works.
@derekcicerone I am hoping to wire up that leg of the source map journey, coffee-script to JS. I was planning to do that as part of jrburke/require-cs#42, and I want it to work even if that plugin does not generate the source map. A sketch:
If there is a "filename.js.map" file, use that as the start map for the source map chain. Hopefully the cs translation would generate that file. Ideally that map uses sourcesContent as it allows the "single file optimization" case better.
If you have foo.coffee and issue coffee -mc foo.coffee it generates foo.js and foo.map (coffee version 1.6.2).
coffee -mc foo.coffee
I'd be happy to do some beta testing of this feature :)