refactor: added {BUILD_TIME} in path js and css files

This commit is contained in:
Yurii
2024-11-12 11:44:02 +03:00
parent 2ff84cbddf
commit 7482eb8898
8 changed files with 19 additions and 13 deletions

View File

@@ -6,6 +6,7 @@ const cssnano = require('cssnano');
const terser = require('gulp-terser');
const jsonminify = require('gulp-jsonminify');
const htmlmin = require('gulp-html-minifier-terser');
const replace = require('gulp-replace');
// Paths for tasks
let paths = {
@@ -119,6 +120,10 @@ const staticFiles = (cb) => {
const pages = () => {
return src(paths.pages.src)
.pipe(replace(
"{BUILD_TIME}",
Math.floor(Date.now() / 1000)
))
.pipe(htmlmin({
html5: true,
caseSensitive: true,

View File

@@ -12,6 +12,7 @@
"gulp-html-minifier-terser": "^7.1.0",
"gulp-jsonminify": "^1.1.0",
"gulp-postcss": "^10.0.0",
"gulp-terser": "^2.1.0"
"gulp-terser": "^2.1.0",
"gulp-replace": "^1.1.4"
}
}

View File

@@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title data-i18n>dashboard.title</title>
<link rel="stylesheet" href="/static/app.css" />
<link rel="stylesheet" href="/static/app.css?{BUILD_TIME}" />
</head>
<body>
@@ -224,7 +224,7 @@
</small>
</footer>
<script src="/static/app.js"></script>
<script src="/static/app.js?{BUILD_TIME}"></script>
<script>
let modifiedTime = null;
let noRegulators;

View File

@@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title data-i18n>index.title</title>
<link rel="stylesheet" href="/static/app.css" />
<link rel="stylesheet" href="/static/app.css?{BUILD_TIME}" />
</head>
<body>
@@ -161,7 +161,7 @@
</small>
</footer>
<script src="/static/app.js"></script>
<script src="/static/app.js?{BUILD_TIME}"></script>
<script>
document.addEventListener('DOMContentLoaded', async () => {
const lang = new Lang(document.getElementById('lang'));

View File

@@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title data-i18n>network.title</title>
<link rel="stylesheet" href="/static/app.css" />
<link rel="stylesheet" href="/static/app.css?{BUILD_TIME}" />
</head>
<body>
@@ -171,7 +171,7 @@
</small>
</footer>
<script src="/static/app.js"></script>
<script src="/static/app.js?{BUILD_TIME}"></script>
<script>
document.addEventListener('DOMContentLoaded', async () => {
const lang = new Lang(document.getElementById('lang'));

View File

@@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title data-i18n>sensors.title</title>
<link rel="stylesheet" href="/static/app.css" />
<link rel="stylesheet" href="/static/app.css?{BUILD_TIME}" />
</head>
<body>
@@ -169,7 +169,7 @@
</small>
</footer>
<script src="/static/app.js"></script>
<script src="/static/app.js?{BUILD_TIME}"></script>
<script>
document.addEventListener("DOMContentLoaded", async () => {
const lang = new Lang(document.getElementById("lang"));

View File

@@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title data-i18n>settings.title</title>
<link rel="stylesheet" href="/static/app.css" />
<link rel="stylesheet" href="/static/app.css?{BUILD_TIME}" />
</head>
<body>
@@ -662,7 +662,7 @@
</small>
</footer>
<script src="/static/app.js"></script>
<script src="/static/app.js?{BUILD_TIME}"></script>
<script>
document.addEventListener('DOMContentLoaded', async () => {
const lang = new Lang(document.getElementById('lang'));

View File

@@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title data-i18n>upgrade.title</title>
<link rel="stylesheet" href="/static/app.css">
<link rel="stylesheet" href="/static/app.css?{BUILD_TIME}">
</head>
<body>
@@ -97,7 +97,7 @@
</small>
</footer>
<script src="/static/app.js"></script>
<script src="/static/app.js?{BUILD_TIME}"></script>
<script>
document.addEventListener('DOMContentLoaded', async () => {
const lang = new Lang(document.getElementById('lang'));