From e6fad8a6c0abf423dde4671d98c8b501c78de05f Mon Sep 17 00:00:00 2001 From: Miodec Date: Sat, 15 Jan 2022 20:53:14 +0100 Subject: [PATCH] using a date format --- gulpfile.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 75105d0b6..07d30db72 100644 --- a/gulpfile.js +++ b/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/"));