[英]How can I combine JS files into one without errors
Below is a list of JS files I am running on my site. 以下是我正在网站上运行的JS文件的列表。 I want to combine them all in to one minified file.
我想将它们全部合并到一个缩小的文件中。 When I do so the page brings up common jquery errors.
当我这样做时,页面会出现常见的jquery错误。 But all I have done is minified them and put them in the same file (in the same order).
但是我要做的就是将它们缩小并放在相同的文件中(以相同的顺序)。
When I keep them individually entered then there is no errors 当我单独输入它们时,就没有错误
jquery-1.8.3.min.js
modernizr-2.6.2-respond-1.1.0.min.js
bootstrap.js
script.js (custom js)
jquery.validate.js
bootstrap.notify.js
jquery.hoverintent.min.js
jquery.cookie.js
jquery.superfish.min.js
jquery.cycle2.min.js
respond.min.js
jquery.magnific-popup.min.js
html5shiv-printshiv.min.js
Like Bobby told you, you can use Grunt to work with some useful tools that allow you minify all your files. 就像Bobby告诉您的那样,您可以使用Grunt来使用一些有用的工具,这些工具可以使您最小化所有文件。
Concretly, the plugin that could help you is contrib-uglify , made by the Grunt Team. 确切地说,可以帮助您的插件是由Grunt Team制作的contrib- uglify。 If you want to use Grunt (and its tools), you can read the Getting Started to install Grunt, and the, follow the instructions to install contrib-uglify.
如果要使用Grunt(及其工具),可以阅读入门以安装Grunt,然后按照说明安装contrib-uglify。 Then, if you want to know how work uglify, you have everything that you need in the Github repository .
然后,如果您想知道如何进行丑化,那么您在Github存储库中拥有所需的一切。
Grunt is very simple and interesting. 咕unt非常简单有趣。 I began to use it recently and I can say that it's very useful.
我最近开始使用它,可以说它非常有用。
I hope that I have help you! 希望对您有所帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.