将多个JavaScript文件合并为一个JS文件 [英] Combine multiple JavaScript files into one JS file

查看:492
本文介绍了将多个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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆