| 123456789 |
- import { readFile, writeFile } from 'node:fs/promises';
- const read = (filename) => readFile(new URL(filename, import.meta.url), 'utf8');
- const [html, css, script] = await Promise.all([read('index.html'), read('styles.css'), read('app.js')]);
- const bundled = html
- .replace('<link rel="stylesheet" href="styles.css" />', () => `<style>\n${css}\n</style>`)
- .replace('<script src="app.js"></script>', () => `<script>\n${script}\n</script>`);
- await writeFile(new URL('mobile-preview.html', import.meta.url), bundled, 'utf8');
- console.log('Built offline prototype: mobile-preview.html');
|