You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we're enqueueing both the theme script file and the theme stylesheet with the same version from index.asset.php if that exists.
However, this means that if the JavaScript isn't updated but the CSS is then the version that lives inside of index.asset.php doesn't update as a result of the build. Which, in turn, means that the stylesheet enqueue doesn't properly update the version to bust CDN caches and will continue to load older cached versions of that stylesheet if those exist.
This is confirmed by the rsync action inside of Buddy with the files it considers "updated" and uploads:
And so I would propose splitting the current scripts() function inside of inc/setup/scripts.php and grab the version from the appropriate asset.php file (/build/js/index.asset.php for the script, /build/js/css/style.asset.php for the stylesheet) when enqueueing.
Alternatively, we can use filmtime() or something of that nature instead or find a way to get it to update the version in index.asset.php if only the CSS is updated, since the theme stylesheet likely won't have any dependencies in its asset file ever so including that file just to get the version might be a little overkill.
The text was updated successfully, but these errors were encountered:
Prior to #33, this code was not working as expected, and the version would always be 0.1.0 regardless of whether or not changes were made to js or css assets:
After #33 was merged, there are still problems. I did a fresh clone of wds-bt's main branch.
After building assets, and checking the network tab, this is what I see for index.js and style.css:
This matches the version in /build/js/index.asset.php:
So things look good. However, after changing some JS and rebuilding, the version in index.asset.php does not change. Even after I delete the build folder and do a rebuild, the version is still the same.
This was a fun one to try and figure out.
Currently, we're enqueueing both the theme script file and the theme stylesheet with the same version from
index.asset.php
if that exists.However, this means that if the JavaScript isn't updated but the CSS is then the version that lives inside of
index.asset.php
doesn't update as a result of the build. Which, in turn, means that the stylesheet enqueue doesn't properly update the version to bust CDN caches and will continue to load older cached versions of that stylesheet if those exist.This is confirmed by the rsync action inside of Buddy with the files it considers "updated" and uploads:
And so I would propose splitting the current scripts() function inside of inc/setup/scripts.php and grab the version from the appropriate asset.php file (
/build/js/index.asset.php
for the script,/build/js/css/style.asset.php
for the stylesheet) when enqueueing.Alternatively, we can use
filmtime()
or something of that nature instead or find a way to get it to update the version inindex.asset.php
if only the CSS is updated, since the theme stylesheet likely won't have any dependencies in its asset file ever so including that file just to get the version might be a little overkill.The text was updated successfully, but these errors were encountered: