简体   繁体   English

为自定义Javascript处理器输出创建源映射

[英]Create source-maps for custom Javascript processor output

Scenario : I currently have to work on a Coffescript project that is (at the moment still) tied to using some outdated and long forgotten browserify predecessor. 场景 :我目前必须从事一个Coffescript项目,该项目(目前仍在使用)与使用一些过时且被人们长期遗忘的browserify前身有关。

Question : What is the best approach for creating source-maps for the resulting file that is created from compiled coffeescript ? 问题 :为通过编译后的coffeescript创建的结果文件创建源映射的最佳方法是什么? Would I have to add sourcemap generation to the stitch processing itself using something like https://github.com/mozilla/source-map/ or is there a more high-level/generic approach that could be applied in this scenario ? 我是否必须使用https://github.com/mozilla/source-map/之类的东西将Sourcemap生成添加到针迹处理本身中,还是在这种情况下可以应用更高级/通用的方法?

For adding a source-map for coffee-script just use the node-js command line tool from the coffee-script package. 要添加coffee-scriptsource-map ,只需使用coffee-script包中的node-js命令行工具即可。

Example : (from coffeescript.org ) 示例 :(来自coffeescript.org
Compile a directory tree of .coffee files in src into a parallel tree of .js files in lib, plus creating the source map files: src.coffee文件的目录树编译为lib中的.js文件的并行树,并创建源映射文件:

coffee --compile --map --output lib/ src/

Personally I would do something like described in this tutorial - creating a sublime workflow . 我个人将按照本教程中的说明进行操作- 创建一个出色的工作流程

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM