Closed (fixed)
Project:
Klaro Cookie & Consent Management
Version:
3.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Dec 2024 at 15:38 UTC
Updated:
1 Jan 2025 at 22:14 UTC
Jump to comment: Most recent
Comments
Comment #2
anybodyAny ideas? I think this is a really major issue and a blocker. Did I make a mistake checking the file size?
BTW shouldn't Drupal use
klaro-no-translations-no-css.jsas all translations come from Drupal?! That's at least "only" 207 KB which is also way too much, but > 600 kb better ;)Comment #3
anybodyAnother interesting thing is, that
klaro.jshas 230 KB at GitHub. So I think we need to understand the differences and why the project page says 30kb vs. x10 in real size. Or does gzip compress it that much?Comment #4
jan kellermann commentedIn my installation klaro-no-css.js has 208K and klaro-no-translations-no-css.js 208K also. I therefore see no urgent need for action here.
In the case that a fork is used at a later date, we can think again about minimization and the like. Slimmer would indeed be nicer.
Comment #5
anybodyThanks for the check and feedback @jan kellermann! Well I think 208K is still way too much! Entire jQuery lib only has 80K and that's large already.
37K as written on the module page would be acceptable, I think.
Have a look at Drupal core's "misc" folder. The js scripts there are all much smaller! So I'd vote to keep this major?
I'll open a bug report at the repo.
We should consider switching to klaro-no-translations-no-css.js by name, right? Also makes no sense to me that they have the same size...
Comment #6
anybodyHere we go: https://github.com/klaro-org/klaro-js/issues/527
Comment #7
catchComment #8
anybody@jan kellermann are you in contact with the Klaro (Lib) maintainers? Maybe they should be informed about the Drupal use in general and asked to cooperate, I think it's a maximum Marketing win for them, even if the Open Source lib is used. Still they don't seem very active in git GitHub repo?
Comment #9
anybodyComment #10
catchJust (re-)discovered this doing performance testing of Drupal CMS, the Klaro library is responsible for over 90% of the JavaScript (whether measuring compressed or uncompressed) served to anonymous users.
One additional thing I noticed on Drupal CMS - the configuration it uses has just a link in the footer, which then opens the cookie consent modal.
It ought to be possible to put all of the code supporting the modal in a separate library that is only loaded when that link is clicked - this would significantly reduce the impact.
Comment #11
jurgenhaas@catch that's what I had in mind too. And we're about to check with the maintainers of that library, if anything with the build process went wrong. Thinking that as e.g. the
no-translationsfiles still contain translations, and the sizes of them, as well as theno-cssfiles, don't significantly differ from the full library.Comment #12
jan kellermann commentedI fixed this bug in klaro-js and opened a pull request.
New file size would be 164K. I look if we can compress more with webpack.
Comment #13
jan kellermann commentedKlaro! is build with compatibility for older browsers. According to Drupal's browser requirements I adapted the build script for
browserslisttodefaults.File Size is now 64K.
Comment #15
jan kellermann commentedOpened Merge Request.
Plese use these files for Testing:
https://github.com/werk21/klaro-js/tree/master/dist
Please review.
Comment #16
jurgenhaasI've tested with the JS lib which is just about 25% of the original size, and everything is still working as before. Great work @jan kellermann, let's get this in as discussed.
Just an additional note: when I add the defer attribute like this:
it does NOT work any longer. The browser console shows an error that
klarois undefined. So, we probably need to go without that extra step.Comment #17
jan kellermann commentedYes, for defer is this issue: https://www.drupal.org/project/klaro/issues/3493822
We had to adapt the JS as you mentioned: https://git.drupalcode.org/project/klaro/-/merge_requests/58.diff
Comment #19
jan kellermann commentedThank you all for reporting, proposals, testing an review.
I merged the code.