Problem/Motivation

The main eu cookie JS file is loaded using 'defer', which is good for an optimized frontend, but since the file is not minified, it still gets flagged by tools like Lighthouse as something that is not fully optimized.
It als is not being picked up by Drupal's aggregation, nor by AdvAgg's minification, so you can't force it to 'optimize' in that way. This makes sense, since the cookie module is telling the script tag to load in a special way, another module interfering with that could run counter to the developer's intention or break stuff.

Proposed resolution

Since a deferred file is not being picked up by Drupal's aggregation, nor by AdvAgg's minification, it might be handy to add and load a minified/uglified version in the module directly.

Comments

rembrandx created an issue. See original summary.

rembrandx’s picture

Version: 2.0.x-dev » 8.x-1.x-dev
iancawthorne’s picture

+1 for this suggestion.

iancawthorne’s picture

Possibly something that would be resolved outside of eu_cookie_compliance with these tickets:
https://www.drupal.org/project/drupal/issues/1587536 (aggregation)
https://www.drupal.org/project/advagg/issues/3072469 (minified)

I've tried the two patches suggested here: https://www.drupal.org/project/advagg/issues/3072469#comment-14141019 and they look to be working as desired.

svenryen’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
svenryen’s picture

Status: Active » Fixed

We now provide a minified version of the javascript with 50% reduced file size.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.