Untitled
unknown
javascript
2 years ago
651 B
11
Indexable
import path from 'path';
import fs from 'fs/promises';
const postProcessIndex = () => {
let config;
return {
name: 'post-process-index',
configResolved: async (resolvedConfig) => {
config = resolvedConfig;
},
closeBundle: async () => {
try {
const filePath = path.join(config.root, '.histoire/dist/index.html');
await fs.access(filePath);
let file = await fs.readFile(filePath, { encoding: 'utf8' });
file = file.replace(/<\/head>/, '<meta name="key" content="value"></head>');
await fs.writeFile(filePath, file);
} catch {
}
}
}
} Editor is loading...
Leave a Comment