将多个 JavaScript 文件合并为一个 JS 文件 [英] Combine multiple JavaScript files into one JS file
本文介绍了将多个 JavaScript 文件合并为一个 JS 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 Web 应用程序中使用 jquery,我需要将更多 jquery 脚本文件加载到单个页面中.
I am using jquery in my web application and I need to load more jquery script files into a single page.
Google 建议我将所有 jquery 脚本文件合并到一个文件中.
Google suggested I combine all the jquery script files into a single file.
我该怎么做?
推荐答案
在 linux 上你可以使用简单的 shell 脚本 https://github.com/dfsq/compressJS.sh 将多个 javascript 文件合并为一个.它利用了 Closure Compiler 在线服务,因此生成的脚本也得到了有效的压缩.
On linux you can use simple shell script https://github.com/dfsq/compressJS.sh to combine multiple javascript files into the single one. It makes use of the Closure Compiler online service so the resulting script is also effectively compressed.
$ ./compressJS.sh some-script.js another-sctipt.js onemore.js
这篇关于将多个 JavaScript 文件合并为一个 JS 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文