Keyword

K2 js and css loading everywhere - unnecessary and disruptive

  • Mark Simpson
  • Mark Simpson's Avatar Topic Author
  • Offline
  • New Member
More
14 years 10 months ago #75132 by Mark Simpson
Hi,

I had trouble deciding where to post this, as it is not a bug and neither is it a feature request in the traditional sense.

I would like to request that you change the way that K2 plugins load css and js; These files should only load on K2 pages and not sitewide.

I know there is no way to make standalone plugins load on selected pages, but this is not the case when the plugins accompany a component.

What are the developers' thoughts on this?

Thank you for your time.

Kind regards,
Mark

Please Log in or Create an account to join the conversation.

More
14 years 10 months ago #75133 by bunglehaze
Mark, what other components are you using? I had a very similar issue with a couple of components dragging through K2 articles, I also had conflicts in js that caused it. You need to feed back more if you expect one of the devs or community to be able to dig in and offer advice.

leigh

Please Log in or Create an account to join the conversation.

  • Mark Simpson
  • Mark Simpson's Avatar Topic Author
  • Offline
  • New Member
More
14 years 10 months ago #75134 by Mark Simpson
Hi bunglehaze,

Thanks for the comment.

I'm sorry if I wasn't clear. I don't have the issue you mention. K2 works as it is meant to for me; mine is not a bug report (your issue certainly sounds like a bug).

I have provided all the info I need to.

K2 requires one or more js and css files. It loads this to the < head >.

My complaint is that this is done site-wide. If I have a 1000 page website, and only one page uses K2, every single one of those 1000 pages loads the K2 js and css files. This is inefficient, unnecessary, and undesirable, hence my post.

Kind regards
-m

bunglehaze said:Mark, what other components are you using? I had a very similar issue with a couple of components dragging through K2 articles, I also had conflicts in js that caused it. You need to feed back more if you expect one of the devs or community to be able to dig in and offer advice. leigh

Please Log in or Create an account to join the conversation.

More
14 years 10 months ago #75135 by JoomlaWorks
Including one css and one js file with K2 sitewide was a necessary decision for various reasons, the most important being:
- Joomla's cache does not behave properly with modules meaning it cannot display attached css/js code using the API
- having the above reason in mind we cannot have module css/js rendered only for the modules (through some system plugin) cause we cannot determine where they appear. E.g. you can have some K2 modules on your site's frontpage yet not have the K2 component.
- deciding to load 1 css and 1 js file is actually good in terms of performance cause it's the bare minimum, plus the browser will cache these 2 files on the first page load. If you add to that the built in templating features of K2 you can disable the css include with the flip of a switch in the component params.

And to clarify one thing you said, the browser does NOT reload these two files AFTER the first page load.

K2 is a professional content tool and it's built with performance and flexibility in mind. ;)Mark Simpson said:Hi bunglehaze,
Thanks for the comment.

I'm sorry if I wasn't clear. I don't have the issue you mention. K2 works as it is meant to for me; mine is not a bug report (your issue certainly sounds like a bug).

I have provided all the info I need to.

K2 requires one or more js and css files. It loads this to the < head >.

My complaint is that this is done site-wide. If I have a 1000 page website, and only one page uses K2, every single one of those 1000 pages loads the K2 js and css files. This is inefficient, unnecessary, and undesirable, hence my post.

Kind regards
-m

bunglehaze said:Mark, what other components are you using? I had a very similar issue with a couple of components dragging through K2 articles, I also had conflicts in js that caused it. You need to feed back more if you expect one of the devs or community to be able to dig in and offer advice. leigh

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Mark Simpson
  • Mark Simpson's Avatar Topic Author
  • Offline
  • New Member
More
14 years 10 months ago #75136 by Mark Simpson
That makes sense. I never thought of the modules.

I know that the CSS and JS files are cached and would only be downloaded once; I meant many visitors to my website will be downloading the K2 files (once) even if they never land on a page with any K2 on it.

Once again, a Joomla limitation has us by the balls.

Anyway, thank you for taking the time to post a detailed response Fotis, I appreciate it.
I'm a big fan of K2, and though I've found the odd annoyance, I'm sure it will only get better as it matures :)


JoomlaWorks said:Including one css and one js file with K2 sitewide was a necessary decision for various reasons, the most important being: - Joomla's cache does not behave properly with modules meaning it cannot display attached css/js code using the API - having the above reason in mind we cannot have module css/js rendered only for the modules (through some system plugin) cause we cannot determine where they appear. E.g. you can have some K2 modules on your site's frontpage yet not have the K2 component.
- deciding to load 1 css and 1 js file is actually good in terms of performance cause it's the bare minimum, plus the browser will cache these 2 files on the first page load. If you add to that the built in templating features of K2 you can disable the css include with the flip of a switch in the component params.

And to clarify one thing you said, the browser does NOT reload these two files AFTER the first page load.

K2 is a professional content tool and it's built with performance and flexibility in mind. ;)Mark Simpson said:Hi bunglehaze, Thanks for the comment.
I'm sorry if I wasn't clear. I don't have the issue you mention. K2 works as it is meant to for me; mine is not a bug report (your issue certainly sounds like a bug).

I have provided all the info I need to.

K2 requires one or more js and css files. It loads this to the < head >.

My complaint is that this is done site-wide. If I have a 1000 page website, and only one page uses K2, every single one of those 1000 pages loads the K2 js and css files. This is inefficient, unnecessary, and undesirable, hence my post.

Kind regards
-m

bunglehaze said:Mark, what other components are you using? I had a very similar issue with a couple of components dragging through K2 articles, I also had conflicts in js that caused it. You need to feed back more if you expect one of the devs or community to be able to dig in and offer advice. leigh

Please Log in or Create an account to join the conversation.

More
14 years 10 months ago #75137 by Terp
Hey, mark, thought of you when that storm hit 'the island' the other day...and should have known that you would beat me to the punch:

k2community.joomlaworks.gr/forum/topics/calling-50k-of-k2-js-and-css

I didn't even create a menu item yet, so zero K2 content on the site, and I noticed this just after installation.... :(

I can live with the small js file and the squeezebox stuff in the source, so may try to use a different css file that gets loaded only on the page with k2 content, if that is possible...since no k2 content/tools anywhere else on the site.

Please Log in or Create an account to join the conversation.

  • Mark Simpson
  • Mark Simpson's Avatar Topic Author
  • Offline
  • New Member
More
14 years 10 months ago #75138 by Mark Simpson
Hey Terp,
Good to see you here :)

I haven't gotten around to it but I'll be stripping out the JS and using one of our extensions to stick it back into pages that need it.

Terp said:Hey, mark, thought of you when that storm hit 'the island' the other day...and should have known that you would beat me to the punch:
k2community.joomlaworks.gr/forum/topics/calling-50k-of-k2-js...

I didn't even create a menu item yet, so zero K2 content on the site, and I noticed this just after installation.... :(

I can live with the small js file and the squeezebox stuff in the source, so may try to use a different css file that gets loaded only on the page with k2 content, if that is possible...since no k2 content/tools anywhere else on the site.

Please Log in or Create an account to join the conversation.

More
14 years 10 months ago #75139 by James Durrant
Hey,

Does anyone know what files in K2 call:
modal.css
SqueezeBox.initialize({});
var K2RatingURL

I'm going to be using GTranslate which runs on JQuery, so I'm removing all the Mootools JS and converting the elements I need to Jquery to save code bloat.

Cheers,

Please Log in or Create an account to join the conversation.

More
14 years 3 months ago #75140 by rexkramer

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum