Merge remote-tracking branch 'origin/master'
All checks were successful
Deploy Remont Site / deploy (push) Successful in 17s
All checks were successful
Deploy Remont Site / deploy (push) Successful in 17s
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const crypto = require('crypto');
|
||||||
const sharp = require('sharp');
|
const sharp = require('sharp');
|
||||||
|
|
||||||
const HERE = __dirname;
|
const HERE = __dirname;
|
||||||
@@ -34,6 +35,14 @@ const OUT = process.env.OUT || path.join(HERE, 'out');
|
|||||||
const OUT_IMG = path.join(OUT, 'images');
|
const OUT_IMG = path.join(OUT, 'images');
|
||||||
const cfg = JSON.parse(fs.readFileSync(path.join(HERE, 'site.config.json'), 'utf8'));
|
const cfg = JSON.parse(fs.readFileSync(path.join(HERE, 'site.config.json'), 'utf8'));
|
||||||
|
|
||||||
|
// хэш содержимого ассета → ?v=… чтобы браузер сбрасывал кэш при изменении CSS/JS
|
||||||
|
function assetVer(rel) {
|
||||||
|
const buf = fs.readFileSync(path.join(HERE, 'assets', rel));
|
||||||
|
return crypto.createHash('md5').update(buf).digest('hex').slice(0, 8);
|
||||||
|
}
|
||||||
|
const CSS_VER = assetVer('style.css');
|
||||||
|
const JS_VER = assetVer('app.js');
|
||||||
|
|
||||||
// ─── утилиты ──────────────────────────────────────────────
|
// ─── утилиты ──────────────────────────────────────────────
|
||||||
const esc = (s) => String(s == null ? '' : s)
|
const esc = (s) => String(s == null ? '' : s)
|
||||||
.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
||||||
@@ -420,7 +429,7 @@ function buildHtml(rooms, sections) {
|
|||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Spectral:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Onest:wght@400;500;600&display=swap&subset=cyrillic,cyrillic-ext,latin" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Spectral:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Onest:wght@400;500;600&display=swap&subset=cyrillic,cyrillic-ext,latin" rel="stylesheet">
|
||||||
<link rel="stylesheet" href="css/style.css">
|
<link rel="stylesheet" href="css/style.css?v=${CSS_VER}">
|
||||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><rect width='100' height='100' rx='20' fill='%237C8A66'/><path d='M25 70V42l25-18 25 18v28H56V52H44v18z' fill='%23F7F3EA'/></svg>">
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><rect width='100' height='100' rx='20' fill='%237C8A66'/><path d='M25 70V42l25-18 25 18v28H56V52H44v18z' fill='%23F7F3EA'/></svg>">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -476,7 +485,7 @@ ${sectionsHtml}
|
|||||||
<img id="lbImg" src="" alt="">
|
<img id="lbImg" src="" alt="">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="js/app.js"></script>
|
<script src="js/app.js?v=${JS_VER}"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>`;
|
</html>`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user