Todd Jenk
Todd Jenk

Reputation: 311

How can I combine JS files into one without errors

Below is a list of JS files I am running on my site. I want to combine them all in to one minified file. When I do so the page brings up common jquery errors. 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

Upvotes: 1

Views: 349

Answers (2)

Ivanhercaz
Ivanhercaz

Reputation: 745


Like Bobby told you, you can use Grunt to work with some useful tools that allow you minify all your files.

Concretly, the plugin that could help you is contrib-uglify, made by the Grunt Team. 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. Then, if you want to know how work uglify, you have everything that you need in the Github repository.

Grunt is very simple and interesting. I began to use it recently and I can say that it's very useful.

I hope that I have help you!

Upvotes: 1

Bobby Russell
Bobby Russell

Reputation: 475

What you're looking for is a build manager. You can use something like Bower or Grunt. If you want to roll your own build manager, this blog post might be helpful.

Upvotes: 2

Related Questions