Best Practice for additional javascript plugins

Support help forum dedicated to free and commerical templates for Joomla 3 and 2.5 version.
GK User
Tue Oct 14, 2014 5:34 pm
Hi Folks,

I would love some advice on how to best add some additional javascript libraries/plugins to my Joomla powered site.

I have 2 use cases:

A) Globally used javascript - javascript I'm likely to use on every page (ie header/footer)

B) Special use javascript - javascript I may need on a single page or article.


Where should I store it? perhaps templates/gk_*/js/
How is best to call it?
Can I take advantage of Gavick's compression?

Thanks in advance for any advice, it is very much appreciated.
User avatar
Fresh Boarder

GK User
Wed Oct 15, 2014 6:15 am
Hi,
next time, I suggest, start from documentation page: https://www.gavick.com/documentation/jo ... ted-pages/
User avatar
Platinum Boarder

GK User
Wed Oct 15, 2014 10:47 am
Hi Oscar,

I read this article, but for me this is far from best practice. Adding more extensions to run extensions is just laborious for the platform. I was hoping I could include them in the template itself (at least the global js files for all pages) . Then they would be included in the compression. For the one of js plugins it may well be the cases that sourcerer or similar is the way to go, but again if I could avoid using another plugin would be ideal.
User avatar
Fresh Boarder

GK User
Wed Oct 15, 2014 11:31 am
But adding your own JS - request changes in template core files,
if you're using old template, you do not have to worry about updates,
but if new template - you have to remember about you code change each time before update template.

But I agree that less means quicker website.
But also note that you probably do not need this extra JS on each subpage.
User avatar
Platinum Boarder

GK User
Wed Oct 15, 2014 11:48 am
Ah you make a very good point, I don't want to miss out on the updates. Ok Thank you for the advice, I should of listened from the start.
User avatar
Fresh Boarder


cron