K2

GK User
Tue Jan 17, 2012 1:17 pm
When I run Pingdom Tools on my site I can see the the file k2.css is being loaded, but I don´t use K2 on my site so does that file really need to be loaded? Is there a way I can make sure that the file isn´t loaded so that I can save a few KB?
User avatar
Platinum Boarder

GK User
Tue Jan 17, 2012 1:44 pm
Hi,

You can prevent the file from loading by:
- Open file: \templates\gk_musicity\layouts\blocks\head.php
- Find this code to remove or comment out:
Code: Select all
$this->addCSS($this->URLtemplate() . '/css/k2.css');
User avatar
Platinum Boarder

GK User
Tue Jan 17, 2012 2:25 pm
Yes that worked. But can´t you in all your templates add a little php that checks of you have K2 installed and if you have it loads the CSS file, if you don´t it doesn´t load the CSS file.

That would save a lot of KB for many users and maybe you can do the same for other third party componentes you support.
User avatar
Platinum Boarder

GK User
Tue Jan 17, 2012 2:32 pm
Yes it can check, please replace the code above by this:
Code: Select all
jimport('joomla.application.component.helper');

if(!JComponentHelper::isEnabled('com_k2', true))
{
$this->addCSS($this->URLtemplate() . '/css/k2.css');
}
User avatar
Platinum Boarder

GK User
Tue Jan 17, 2012 2:44 pm
That´s good but I don´t need it. I thought it could be a good thing to add as standard for all templates and release an update. I think there are more people than me that don´t use for example K2 and then they also could save, I think it was 70 KB from the size of their sites.
User avatar
Platinum Boarder

GK User
Tue Jan 17, 2012 3:06 pm
Yes you are right, this should be applied for next versions of templates, I will convey the same to our development team.

Have a nice day!
User avatar
Platinum Boarder

GK User
Tue Jan 17, 2012 4:29 pm
Thanks! I think the Gavick templates and extensions overall needs to be more optimized for speed. So if there are other things the development team can do to make the templates faster it would be really nice!
User avatar
Platinum Boarder


cron