dole
dole

Reputation: 433

How to unify js files, when is about jQuery plugins

On a prestoshop ecommerce site I have some modules which use jQuery plugins. The problem is that i have a lot of file requests and YSlow recommends me to use fewer requests by unifying the .js files.

Can you give me an advice about how can I unify the files used by those modules(which are basicaly jQuery plugins)?

Upvotes: 1

Views: 934

Answers (1)

Raynos
Raynos

Reputation: 169383

It's telling you to use pack multiple javascript files into one. This may or may not be neccesary depending on how you load your files.

If you use something like head.js which loads your files async after the page is loaded then your page won't be blocking whilst your loading so packing them together doesnt matter

Or you can use something like multi-part XHR which will combine them for you. Take a look at supply.js.

Another popular option is require.js (Havn't checked that website in a while. It looks pretty neat. Loving the layout)

If you using a lot of <script src="foo"> in your <head> tag well then that's not a good way to go about it.

Upvotes: 2

Related Questions