Bug 1918 - Minify JavaScript and CSS
Summary: Minify JavaScript and CSS
Status: CLOSED WONTFIX
Alias: None
Product: Koha
Classification: Unclassified
Component: Installation and upgrade (web-based installer) (show other bugs)
Version: Main
Hardware: All All
: P3 enhancement (vote)
Assignee: Dobrica Pavlinusic
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-05 06:56 UTC by Owen Leonard
Modified: 2023-06-08 22:26 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 1918 - Minify JavaScript and CSS (22.61 KB, patch)
2012-04-11 12:25 UTC, Dobrica Pavlinusic
Details | Diff | Splinter Review
Bug 1918 - Minify JavaScript and CSS (22.94 KB, patch)
2012-06-05 07:27 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Cormack 2010-05-21 00:36:07 UTC


---- Reported by oleonard@myacpl.org 2008-03-05 06:56:57 ----

Performance guidelines suggest that JavaScript (and CSS) files be minified to reduce file size:

http://developer.yahoo.net/blog/archives/2007/07/high_performanc_8.html

It was suggested that this process could be done upon installation, leaving the original files in Git in a format that's friendly to the developer.



--- Bug imported by chris@bigballofwax.co.nz 2010-05-21 00:36 UTC  ---

This bug was previously known as _bug_ 1918 at http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=1918

Actual time not defined. Setting to 0.0

Comment 1 Dobrica Pavlinusic 2012-04-07 21:59:04 UTC
I would like to address this one as part of performance work.

I found https://github.com/jshirley/Plack-Middleware-ComboLoader which got me pushed in right direction, but in the end I decided to implement Koha::Template::Plugin::Combine because it turned out that it's easier if we can use combining and minification together.

Changes are available at:

https://github.com/dpavlin/Koha/compare/dpavlin:plack...dpavlin:bug_1918-combine

Minification alone doesn't buy us much:

OPAC search:
minify js 334974 -> 311553 93.01%
minify css 148277 -> 133128 89.78%

intranet search:
minify js 382102 -> 362172 94.78%
minify css 134754 -> 123771 91.85%

But combining JS and CSS files together saves us round-trips to server:

OPAC 32 -> 20 requests
intranet 27 -> 13 requests

I would love to hear your feedback on this.
Comment 2 Chris Nighswonger 2012-04-08 00:33:54 UTC
This seems to be related to the loading sequence of css and js we were discussing on irc the other day. I opened bug 7906 for it which may be a duplicate of this one.

I think any performance improvements should be pushed forward.
Comment 3 Dobrica Pavlinusic 2012-04-11 12:25:33 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2012-06-05 07:27:08 UTC
Created attachment 9917 [details] [review]
Bug 1918 - Minify JavaScript and CSS

Rebased patch.

I test for curiosity :)
For testing, install libjavascript-minifier-xs-perl and libcss-minifier-xs-perl.
You need to create a koha-tmpl/intranet-tmpl/prog/en/combined directory with write mode for www-data

Feedback:
With firebug, I see 2 errors on the intranet detail page:
GET menu-button-arrow.png 404 Not Found
GET sprite.png 404 Not Found

detail.pl:
21 requests 165.2 KB (159 KB from cache) 2.41s (onload: 2.5s)
vs
9 requests 158.9 KB (146.2 KB from cache) 2.66s  (121.8 KB JS + 24.3 KB CSS)

search.pl (results):
20 requests 167.8 KB (159 KB from cache) 1.6s (onload: 3.68s)
vs
4 requests 158.2 KB (146.2 KB from cache) 4.04s (onload: 4.05s)  (121.8 KB JS + 24.3 KB CSS)


We observe a decrease of the number of requests and data size, but also a small increase of the load time.
I don't know if you have checked the load time.

I did not test with Plack !
Comment 5 Dobrica Pavlinusic 2012-06-11 15:12:54 UTC
Thanks for rebase, I don't think this patch is really ready for sign-off so I'm changing status of this bug.

I will need to investigate increase for on-load time, but since we are executing extra code to produce combined files, and emitting larger CSS and JavaScript files I would expect a small difference.

For one thing, it still has warn(s) in it, so RM will fail QA on it, and on the other there are a few references to Koha::Persistant which is my internal thingy to track usage and should be replaced with Koha::Cache code in future.
Comment 6 Jonathan Druart 2015-02-20 16:18:16 UTC
Any progress here?
Comment 7 Owen Leonard 2020-01-18 20:58:31 UTC
We have moved towards having a build process for client-side assets with the introduction of SCSS, so I'm inclined to mark this "WONTFIX."
Comment 8 Katrin Fischer 2020-01-19 10:26:02 UTC
(In reply to Owen Leonard from comment #7)
> We have moved towards having a build process for client-side assets with the
> introduction of SCSS, so I'm inclined to mark this "WONTFIX."

+1