tischlerei-staffenberger/scripts/build.js
mrwhiski f2507033c3 Real contact/Impressum data, SEO tags, responsive gallery images, a11y and templating fixes
- Impressum rewritten with real Austrian business data (ECG instead of
  German TMG references); UID, Gewerbeberechtigung and Firmenbuchnummer
  marked as pending until available
- Real contact email/phone/address across footer and Impressum
- Meta description, Open Graph tags and favicon on all pages
- Gallery images now offer both 800w and 1920w srcset candidates
- Lightbox traps focus while open and restores it on close
- Header/footer extracted into partials/, pages now built from
  templates/ via `npm run build` (scripts/build.js) to remove
  duplication across the 4 pages
2026-07-12 18:11:11 +02:00

39 lines
1.2 KiB
JavaScript

/**
* Static page builder for Tischlerei Staffenberger.
* Expands <!-- include:partials/x.html --> markers in templates/*.html
* with the referenced partial's contents and writes the result to the
* project root (index.html, pictures.html, shop.html, impressum.html).
*
* Run: node scripts/build.js
*/
'use strict';
const fs = require('fs');
const path = require('path');
const PROJECT_ROOT = path.join(__dirname, '..');
const TEMPLATES_DIR = path.join(PROJECT_ROOT, 'templates');
const INCLUDE_RE = /[ \t]*<!-- include:([\w./-]+) -->/g;
function expandIncludes(content) {
return content.replace(INCLUDE_RE, (match, includePath) => {
const partialPath = path.join(PROJECT_ROOT, includePath);
return fs.readFileSync(partialPath, 'utf8').replace(/\n$/, '');
});
}
function main() {
const pages = fs.readdirSync(TEMPLATES_DIR).filter(f => f.endsWith('.html'));
for (const page of pages) {
const templatePath = path.join(TEMPLATES_DIR, page);
const outputPath = path.join(PROJECT_ROOT, page);
const content = expandIncludes(fs.readFileSync(templatePath, 'utf8'));
fs.writeFileSync(outputPath, content);
console.log(`built ${page}`);
}
}
main();