[英]Combine javascript files and their source maps
I am struggling with the combination of multiple javascript files and their source maps. 我正在努力将多个javascript文件及其源代码映射组合在一起。
The problem is: I use Google Closure Compiler to obfuscate two javascript files A and B, with generated source maps A.map and B.map. 问题是:我使用Google Closure Compiler混淆了两个javascript文件A和B,以及生成的源映射A.map和B.map。 Since I apply different compilation options on them, so compiling A and B into a single file does not work for me. 由于我对它们应用了不同的编译选项,因此将A和B编译到一个文件中对我不起作用。 Now, I want to combine A and B to AB, and also combine A.map and B.map into AB.map. 现在,我想将A和B组合为AB,还将A.map和B.map组合为AB.map。
How should I do this? 我应该怎么做? Any existing tools suitable for this purpose? 是否有适合此目的的现有工具?
There are a number of packages out there that will do the job for example with the grunt-concat-sourcemap package for node you can do the following: 有很多可以完成此任务的软件包,例如,对于节点,可以使用grunt-concat-sourcemap软件包来执行以下操作:
grunt.initConfig({
concat_sourcemap: {
options: {},
target: {
files: {
'dest/out.js': ['src/a.js', 'src/b.js']
}
}
}
})
this will concatenate the two specified source files(in order), and write the output to dest/out.js and dest/out.js.map 这将连接两个指定的源文件(按顺序),并将输出写入dest / out.js和dest / out.js.map
here are some links to packages for grunt, gulp and plain node: 这是grunt,gulp和Plain节点软件包的一些链接:
https://www.npmjs.com/package/grunt-concat-sourcemap https://www.npmjs.com/package/grunt-concat-sourcemap
https://github.com/mikach/gulp-concat-sourcemap https://github.com/mikach/gulp-concat-sourcemap
https://www.npmjs.com/package/source-map-concat https://www.npmjs.com/package/source-map-concat
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.