diff --git a/Ремонт квартира/.site/generate.js b/Ремонт квартира/.site/generate.js index 689103e..782209d 100644 --- a/Ремонт квартира/.site/generate.js +++ b/Ремонт квартира/.site/generate.js @@ -25,6 +25,7 @@ */ const fs = require('fs'); const path = require('path'); +const crypto = require('crypto'); const sharp = require('sharp'); const HERE = __dirname; @@ -34,6 +35,14 @@ const OUT = process.env.OUT || path.join(HERE, 'out'); const OUT_IMG = path.join(OUT, 'images'); 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) .replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); @@ -420,7 +429,7 @@ function buildHtml(rooms, sections) { - + @@ -476,7 +485,7 @@ ${sectionsHtml} - + `; }