-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove VERSION from libraries.yml #408
Comments
Interesting @andybroomfield I don't seem to get the hash as well as the version number. I'm using 10.4.1 at the moment. I also noticed a few modules which seem to be removing |
@millnut As most sites will use css and js aggregation, this issue wouldn't occur for those sites? |
Let me check that @andybroomfield just incase Drupal does anything unexpected as part of the aggregation, I know recently there have been a lot of changes in and around the aggregation of js/css |
Searching led me to this article which explains the version key and a Drupal issue that this is not available to contrib modules. So I agree, we should remove it even if it is standard to use it because:
Subject to checks that this does not effect css and js aggregation (I don't think it should). We should do the same in any other LGD module. |
Thanks for finding that issue @andybroomfield I was searching for that in my history/bookmarks but couldn't find it |
The
version: VERSION
lines in libraries.yml create a version query string using the Drupal Core version number for the asset files. This causes the files to be cached in the browser and will only invalidate when the core version changes due to the dependency on the version.When using edge caching or CDN caching this makes it difficult to invalidate the cache if there are changes to these assets and it requires users to manually clear their browser cache to get updated asset files.
By removing the
VERSION
Drupal will generate a hash id to the file which can be invalidated and new hash IDs generated when the Drupal cache is cleared e.g.drush cr
The string changes on every update or full cache flush, forcing browsers to load a new copy of the files as the URL changed.
Examples with no
VERSION
set showing changes based on cache clears;The text was updated successfully, but these errors were encountered: