-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathout.js
28 lines (24 loc) · 892 Bytes
/
out.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// create out directory for static Chrome Extension
const fse = require('fs');
const glob = require('glob');
const files = glob.sync('out/**/*.html');
files.forEach((file) => {
const content = fse.readFileSync(file, 'utf-8');
const modifiedContent = content.replace(/\/_next/g, './next');
fse.writeFileSync(file, modifiedContent, 'utf-8');
});
const Jsfiles = glob.sync('out/**/*.css');
Jsfiles.forEach((file) => {
const content = fse.readFileSync(file, 'utf-8');
const modifiedContent = content.replace(/\/_next/g, './next');
fse.writeFileSync(file, modifiedContent, 'utf-8');
});
const sourcePath = 'out/_next';
const destinationPath = 'out/next';
fse.rename(sourcePath, destinationPath, (err) => {
if (err) {
console.error('Failed to rename "_next" directory to "next".', err);
} else {
console.log('Renamed "_next" directory to "next" successfully.');
}
});