問題描述
有人在這方面取得過成功嗎?
Has any one had any success with this?
推薦答案
我認(rèn)為這或多或少是一個未解決的問題:https://github.com/jashkenas/coffee-script/issues/2779 .最后一個有意義的評論來自一個月前的 jwalton.
I think it's more or less an unsolved problem: https://github.com/jashkenas/coffee-script/issues/2779 . Last meanigingful comment was from jwalton, a month ago.
不過,增加對它的支持似乎不是火箭科學(xué),所以它可能很快就會到來.
Still, it doesn't seem rocket science to add support for it, so it will probably come soon.
Michael Ficarra(CoffeeScript Redux 的創(chuàng)建者)建議使用 https://github.com/michaelficarra/commonjs- 無處不在 .
Michael Ficarra (creator of CoffeeScript Redux) suggested using https://github.com/michaelficarra/commonjs-everywhere .
兩個警告:
- 它僅適用于捆綁 CommonJS 模塊.
- 它使用的是 CoffeeScript Redux,它仍處于測試階段(盡管看起來工作得很好),并且與原始 CoffeeScript 編譯器不是 100% 兼容.
所以這不適用于您特別要求的連接".
So this does not work for what you ask for specifically, "concatenation".
您可能會很幸運:combine-source-map 和/或generate-sourcemap,均出自同一作者.
You might have luck with these: combine-source-map and/or generate-sourcemap, both by same author.
這看起來很簡單:https://npmjs.org/package/mapcat.您只需將咖啡編譯器生成的各個源映射文件提供給它.
This looks really simple: https://npmjs.org/package/mapcat . You just have to feed it the individual source map files generated by the coffee compiler.
Mariusz Nowak 剛剛發(fā)布 webmake-coffee.與 CommonJS Everywhere 一樣,它需要將代碼組織為 CommonJS 模塊.與其他地方的 CommonJS 不同,它使用常規(guī)的 CoffeeScript.
Mariusz Nowak has just released webmake-coffee. Like CommonJS Everywhere, it requires code to be organized as CommonJS modules. Unlike CommonJS everywhere, it uses regular CoffeeScript.
Grunt Coffee-Script 插件 似乎也有源映射支持連接文件很長一段時間(兩個月),有效地證明我原來的答案是不正確的.
It also seems the Grunt Coffee-Script plugin has had source-map support for concatenated files for quite a while (two months), effectively proving my original answer to be incorrect.
即將推出的 Snockets 2.0 版也將支持它.
The upcoming version 2.0 of Snockets will have support for it too.
這篇關(guān)于為從 Coffeescript 編譯的多個連接的 javascript 文件生成源映射的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!