Jump to content

javascript optimization


sttaq

Recommended Posts

Hi

 

PrestaShop provides a function called addJS if you want to add javascript to a page. The problem with this is that it adds the javascript at the top of the page. This approach however is discouraged and it is recommended that loading of javascript is deferred and the only way to achieve this is to link the javascript at the bottom instead of linking it at the top.

 

Is there a way this can be achieved by any method or by modifying the source?

 

Also, is it possible to use a CDN ONLY for libraries such as jQuery and if it is then I would like to know how to do this.

 

Thanks

  • Like 1
Link to comment
Share on other sites

Hi sttag,

 

El Patron made a module for this. which does exactly this and more. (It also combines js files in one to speed up even more the loading time. Seems worth it's money!)

 

http://www.etiendas.co/en/54-prestashop-performance-java-manager-advanced.html

 

You can do something yourself by moving code from header to footer, but it comes with many problems/checking if pages still load well, inserting file includes manually etc.

 

My 2 cents,

pascal.

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...