#26751 closed defect (bug) (fixed)
Bust browser cache when building alpha/beta versions and when running from /src
Reported by: | azaozz | Owned by: | nacin |
---|---|---|---|
Milestone: | 4.0 | Priority: | normal |
Severity: | normal | Version: | 3.9 |
Component: | Build/Test Tools | Keywords: | |
Focuses: | Cc: |
Description
Bumpbot used to do this when minifying scripts and stylesheets. We can move cache busting to Grunt when building alpha/beta versions, and to script-loader.php when running from /src.
Attachments (6)
Change History (24)
This ticket was mentioned in IRC in #wordpress-dev by azaozz. View the logs.
11 years ago
#4
@
11 years ago
In 26751.1.patch:
- Drop the changes to script-loader for always refreshing in /src for now. All developers would know to refresh the browser caches :)
- Change the string appended to $wp_version on build to be the current date (yyyymmdd), so it refreshes once a day.
#5
@
11 years ago
- Component changed from General to Build Tools
Two thoughts:
- A simple check for a hyphen should be sufficient once -src is removed.
- On the other hand, it'd be nice to ship a clean version number for beta and RC packages. To me this sounds like the date should only replace an existing date, thus requiring a developer to "restart" the count after a package. (And, thus, two hyphens can be looked for, then everything after the second hyphen removed and the date added.)
Agree/disagree/better idea?
#6
@
11 years ago
...it'd be nice to ship a clean version number for beta and RC packages.
True but then the nightlies won't bust the cache during beta and RC. One way to fix this is to have a separate var in version.php specifically for cache busting.
#7
follow-up:
↓ 8
@
11 years ago
I only mean I'd like wordpress-3.9-beta1.zip to ship with the 3.9-beta1 version number. The next day's nightly can contain 3.9-beta1-$date. I'm not sure how to handle that. Thinking.
#8
in reply to:
↑ 7
@
11 years ago
Replying to nacin:
The best way seems to be to "manually" control it (like your suggestion above): only replacing an existing date string. It will need one more commit after releasing beta or RC (to add back the date string), but will be very straightforward.
#9
@
11 years ago
- Milestone changed from 3.9 to Future Release
We can do grunt.template.today for dates. I like this but let's do it in 4.0 at this point.
#12
follow-up:
↓ 18
@
10 years ago
"If the version includes a date string, update it" gave me an idea. Rather than putting a date string in /src, we should continue to just put SVN revision strings, and replace those with a date. So, we'd bump to 4.0-beta1-src, then package and release 4.0-beta1, then bump to 4.0-beta1-29000-src, which will be packaged in the nightly as 4.0-beta1-20140702. I think this will work nicely, yes.
This has the added benefit of using the same format as auto updates already do on the API side, which will reduce the updates from every 12 hours to once a day.
Also: the nightly won't change if there weren't any commits that day as the grunt task wouldn't have been run on post-commit. (But also, the nightly script only runs when it detects there has been a commit.)
#14
@
10 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
r28611 fails Grunt jshint:grunt task https://travis-ci.org/ntwb/wordpress/jobs/26274829
Running "jshint:grunt" (jshint) task Linting Gruntfile.js ...ERROR [L88:C53] W109: Strings must use singlequote. return "$wp_version = '" + version + "';"; [L88:C70] W109: Strings must use singlequote. return "$wp_version = '" + version + "';"; Warning: Task "jshint:grunt" failed. Use --force to continue.
Incoming 26751.4.diff fixes this
#15
follow-up:
↓ 16
@
10 years ago
Uh, my bad, didn't lint the patch :)
For readability's sake double quotes there make more sense, perhaps 26751.5.patch?
#16
in reply to:
↑ 15
@
10 years ago
Replying to azaozz:
For readability's sake double quotes there make more sense, perhaps 26751.5.patch?
Agreed, readability matters (I had to reread my own patch ~10 times, didn't know we could override jshint like this)
#18
in reply to:
↑ 12
@
10 years ago
Replying to nacin:
Rather than putting a date string in /src, we should continue to just put SVN revision strings, and replace those with a date.
Yeah, that is the best solution :)
The only thing remaining to maybe (eventually one day) consider is resurrecting part of bumpbot to automatically replace the SVN revision after changes to JS or CSS files are committed.
In 26751.patch:
Refreshing cache on every page load in /src may be a bit too aggressive but will help when debugging and testing js and css changes.