assayo/scripts/add-local.js

17 lines
568 B
JavaScript
Raw Permalink Normal View History

2024-05-03 08:34:46 +00:00
const fs = require('node:fs');
const prefixes = [ './', '../', '../../', '/'];
const suffixes = (new Array(6)).fill(1).map((a, i) => i + 1);
const paths = [];
prefixes.forEach((prefix) => {
paths.push(`<script src='${prefix}log.txt'></script>`);
suffixes.forEach((suffix) => {
paths.push(`<script src='${prefix}log-${suffix}.txt'></script>`);
});
});
const content = paths.join('');
const html = fs.readFileSync('../build/index.html', 'utf8');
2024-09-06 22:55:28 +00:00
const text = html.replace(/<\/title>/gim, `</title>${content}`);
2024-05-03 08:34:46 +00:00
fs.writeFileSync('../build/index.html', text);