-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
AssetManager creates different hash for same pipelined files when extra asset is added to before/after position #2781
Comments
Ordering can have a profound impact on both CSS and JS. If you had an issue with a particular order, and you fixed it by changing the order, your browser would not pick up the change if the hash remained the same. The real issue is why your asset that is 'after' the pipelined assets, affecting the hash. This is probably because the 'before' and 'after' assets should be skipped in hash calculation. |
What do you mean by 'changing order':
In case of 2. the hash should definitely change. Yes, the issue I'm referring to is that after/before assets should not impact the hash. |
Did some debugging and found that in Assets::addType(), the order ( Hence, if on some page a plugin adds an extra asset in the before/after position, assets added later in the process receive a different 'order' value. Since the 'order' is part of the value on which the hash for 'pipelined' assets is calculated, the hash will change. Problem: Possible solution:
Above code prevents Grav to generate a new asset file (with exact same content already loaded) to be loaded by the browser when a plugin adds assets in the before/after position. |
Any progress on this? |
Afraid not yet. |
@NicoHood, That's fine with me... And thanks for picking this up. |
Grav version: grav-admin-v1.7.0-rc.2
Problem:
AssetManager creates different hashes for pipelined files when extra asset is added in 'before' or 'after' position. The contents of the different pipelined files are exactly the same though.
Expected result:
Assets in position before/after should not change hash of pipelined assets.
Example:
I have the following in base.html.twig:
The output is:
On some pages I add a plugin. My plugins add assets as follows:
The output is:
The contents of '3c4701a9a8e3c486b719e9d09e64a839.js' and '24180c8c0af4f6c7bc1b1f1f95235033.js' are according to diff exactly the same.
The text was updated successfully, but these errors were encountered: