-
Notifications
You must be signed in to change notification settings - Fork 863
Revisioned assets for gulp --production #944
Comments
Like the idea as some browser really stick their cache with hard glue!! ;) I now have the habit to "command"+"shift"+"R" but clients do not know! |
I'd find it helpful to have assets reved automatically. |
Absolutely! Cache busting inclusion would be extremely helpful! |
Are you guys experiencing cache issues when using browser-sync? |
Nope, browser-sync works fine. This addresses a different issue: I finish my local work, push it to staging for client review and they report things are broken because the client's browser has cached css and js. |
@colinduwe thanks for the explanation, that makes sense. I'm assuming this is the way we would have to implement it in FoundationPress?: |
Sorry for coming in late to the discussion. The way we load stylesheets and scripts in WordPress is using This works like a cache breaker. However, this is a manual process and you'll need to update these by yourself before pushing your theme to a production server. It could be nice to have this automated by a task runner. @colinduwe : If you'd like to submit a PR for this, I'm happy to review it. |
I have also come across this issue, clients not seeing newest changes and what not. My solution was to use filemtime. Like below:
This sets the version number when the file gets rebuilt by gulp therefore breaking the browser cache everytime there has been a change to the file and you push those changes. Could be a quick and easy solution to implement. |
As mentioned above, we have a manual cache breaker method available today. If this process were to be automated, I suggest we should generate a hash on each |
The Sage theme implements https://github.com/sindresorhus/gulp-rev so when you run gulp --production a new hash is appended to css and js output to /dist/
I find this very helpful since it busts the browser cache and you don't have to tell clients to please SHIFT+Reload, etc.
Is this something others would find helpful? If so I'll put together a PR.
The text was updated successfully, but these errors were encountered: