javascript - 将多个 JavaScript 文件组合成一个 JS 文件

标签 javascript jquery jquery-ui

<分区>

我在我的网络应用程序中使用 jquery,我需要将更多的 jquery 脚本文件加载到一个页面中。

Google 建议我将所有 jquery 脚本文件合并到一个文件中。

我该怎么做?

最佳答案

在 Linux 上你可以使用简单的 shell 脚本 https://github.com/dfsq/compressJS.sh将多个 javascript 文件组合成一个文件。它利用 Closure Compiler 在线服务,因此生成的脚本也得到了有效压缩。

$ ./compressJS.sh some-script.js another-sctipt.js onemore.js

关于javascript - 将多个 JavaScript 文件组合成一个 JS 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5511989/

相关文章:

jquery - 如何使用 jQuery 调整移动设备上的图像大小?

javascript 无法从网络驱动器运行

javascript - 将类添加到包含 <strong> 标记的 <li> 元素

javascript - 同一页面中的不同 jQuery 源和版本(googleapi、代码)

c# - 如何通过 HtmlDocument.InvokeScript 将对象作为参数传递给 javascript

javascript - 选择没有选项的框宽度

javascript - 我可以在过滤方法中使用变量吗?

javascript - 如何将对象保存到 Node.js 中的文件?

javascript - Phonegap 插件 - imagePicker - 生成错误消息

javascript - 我如何让 jQuery 与我一起工作?