mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-03 20:40:48 +08:00
using a date format
This commit is contained in:
parent
bf1dd9f0c1
commit
e6fad8a6c0
1 changed files with 14 additions and 1 deletions
15
gulpfile.js
15
gulpfile.js
|
@ -261,11 +261,24 @@ task("clean", function () {
|
|||
});
|
||||
|
||||
task("updateSwCacheName", function () {
|
||||
let date = new Date();
|
||||
let dateString =
|
||||
date.getFullYear() +
|
||||
"-" +
|
||||
(date.getMonth() + 1) +
|
||||
"-" +
|
||||
date.getDate() +
|
||||
"-" +
|
||||
date.getHours() +
|
||||
"-" +
|
||||
date.getMinutes() +
|
||||
"-" +
|
||||
date.getSeconds();
|
||||
return src(["static/sw.js"])
|
||||
.pipe(
|
||||
replace(
|
||||
/const staticCacheName = .*;/g,
|
||||
`const staticCacheName = "sw-cache-${Date.now()}";`
|
||||
`const staticCacheName = "sw-cache-${dateString}";`
|
||||
)
|
||||
)
|
||||
.pipe(dest("./dist/"));
|
||||
|
|
Loading…
Reference in a new issue