| 1234567891011121314 |
- import { readFile, writeFile } from 'node:fs/promises';
- const directory = new URL('./', import.meta.url);
- const [template, styles, script] = await Promise.all(
- ['preview.template.html', 'styles.css', 'app.js'].map((name) =>
- readFile(new URL(name, directory), 'utf8'),
- ),
- );
- await writeFile(
- new URL('index.html', directory),
- template
- .replace('/* STYLES */', () => styles)
- .replace('/* SCRIPT */', () => script.replaceAll('</script', '<\\/script')),
- );
- console.log('Built standalone index.html (no network dependencies)');
|