Skip to main content
Topic: Combining JS (Read 1668 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Combining JS

I got these three js on my forum and I am wondering, whether it is good to combine them as one and how to do it, effectively.
Code: [Select]
<script src="http://elkarte.sch.my/themes/default/scripts/jquery-1.11.1.min.js" id="jquery"></script>
<script src="http://elkarte.sch.my/themes/default/scripts/jquery-ui-1.10.4.min.js" id="jqueryui"></script>
<script src="http://elkarte.sch.my/cache/hive-e1788f8b777120fdeafe83580e4e3ed414f11e56.js?9f246aca" id="jscombinedtop"></script>

Re: Combining JS

Reply #1

These three are already minified files.
The only thing you'd save combining them is 2 requests each page.
On the other hand, for the way minification is done, you'd have to serve a much bigger minified file different for most of the pages[1].

We decided not to include minified files in the minification process exactly for that reason. I don't think combine them would give you any advantage apart from some googlepagespeed-like test not telling you "you should combine all the js files to gain 0.05 KB". ;D
This means: board index has a minified file, message index has another, "display" has a third. If you were to include the minified jquery files you'd have to serve jquery three times in these three files. This way, going from one page to the other, if the server is configured properly sending the expiration dates and cache information to the browser, the files are actually downloaded once and re-used in any other page.
Bugs creator.
Features destroyer.
Template killer.

Re: Combining JS

Reply #2

Thank you for the input.

As for the pagespeed, the test site already scored 92% on desktop and 79% while on mobile. So nothing much can be done for now except for a more user-friendly design in mobile view.