Javascript concatenating

at the moment approx 20 seperate js scripts get load (seperate request for each)

Maybe just add a script that concatenates them together.

Javascripts are loaded on demand by the templates, if you would automate this, the result would be different on every page, so this is more a task for the shop owner on an individual basis.

hmmm is there no-way to get smarty to do it ?
i’ve been looking at various filters, but they are all somewhat old and don’t seem to want to work.

OCPHP | Orange County PHP

Irvine, CA
850 Developers

Meet PHP Developers near you! Come to a PHP Meetup to exchange ideas and talk about code, architecture, innovation, and open source in general. Anyone interested in PHP is wel...

Check out this Meetup Group →

I’m just curious, as its generally recommended as one the ways to optimize sites, less requests.
And if i just use the demo site as an example, http://demoshop.oxid-esales.com/professional-edition/
it loads 27 different js files, so you cant tell me it would not benefit from it.

And i have no problems that it has to be done by individual shop owners, but i cannot find any information here, how to?

Sure you would benefit, but which files you really need depends on the features you use, and if you would compile them automatically, when you move to the next page you may need another script (for example on details page for variant selection) which was not needed on start page, then your compiled result would be different and you would load all scripts again instead of fetching them from browsercache.
If you want to do it manually you could copy all the scripts you always need to one and include this in base.tpl, then delete the js-Files you included (a file which does not exist will not get written into html source code).

Surely the whole point of smarty is that it caches the whole page - individually.
So when i have index page with 27 js scripts, it shoud be possible to minify and concatenate them into a one specific cached js file - for the index page
And then on page 2 when i have only 17 js scripts, a new cached js file for page 2, etc, etc
So yes initially, one would have a one off extra load when the files where first minified and concatenated, but thats it.
And after the initial extra load, you would have a considerable gain in speed.

I’m not quite sure what you have against this ?
Its a feature request, in every article that you find anywhere about optimization and speed, from the w3c to google page speed, they all say minify, and less file requests.
Oxid neither minifys the javascript files, or concentates them.
This is generally accepted as bad practice.
Thats why i thought it would be a good new feature.

Good point actually. I think “less” would be a good solution for it. Less was introduced with the mobile theme which is intended to be built up as responsive lateron. This might (not a promise or clean commitment yet!) replace azure as it is now.

Cheers

i personally prefer sass, either way is that not only useful for css ?
And ignoring that would it not be better to use minify ?

[QUOTE=soup;142643]Surely the whole point of smarty is that it caches the whole page - individually.
So when i have index page with 27 js scripts, it shoud be possible to minify and concatenate them into a one specific cached js file - for the index page
And then on page 2 when i have only 17 js scripts, a new cached js file for page 2, etc, etc
[/QUOTE]
Smarty caching makes no difference here. Js-Libraries are cached by the browser. So in your example, with separate js-files the browser loads 27 Files on the first page, and 0 Files on page 2, because all 17 Files are already cached. If you would generate a new concatenated file for the 2. page which contains only those 17 Files, the browser would have to fetch all of them again.

seeing as 90% of the widgit files are less than 100 lines, including the 35 lines of oxid blah, even if you just minified, and concatenated the widgit files, you would only have one page request for them, anyway i dont understand what you’ve got against this ?
This is an incredibly negative forum, it was a suggestion, feature request nothing else.
If you are so happy with oxid and think its absolutely perfect as it is, then fine.

I’m not trying to suggest the best way of doing it, i am just suggesting that it would be a good idea
And it also to maybe get both jquery and jquery ui from a cdn instead of locally, because yes they probably would already be cached then.

Well my viewpoint seems to differ from yours, i tried to point out my reasons and even showed you another way to achieve what you want, if you think this is incredibly negative, i won’t bother anymore.

yeah it does differ, i have already instigated what i wanted in my shop.
And was not asking for advice here, - note the heading of this forum "Feature Requests"
It would be a nice feature to have in a future version of oxid.
And yes one would have to think about the best way of implementing, like any other new feature.
All i thought it that it would be a good idea for everyone to have this, and it to be automated by oxid, so that the shop owners do not have to individually do this, which theoretically everyone should do