-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreplace.js
More file actions
34 lines (31 loc) · 1.05 KB
/
replace.js
File metadata and controls
34 lines (31 loc) · 1.05 KB
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
29
30
31
32
33
34
const fs = require('fs');
const path = require('path');
const replacements = {
'--bg-color': '--background',
'--surface-color': '--surface',
'--surface-hover': '--surface',
'--text-main': '--textPrimary',
'--text-muted': '--textSecondary',
'--border-color': '--border',
'--primary-color': '--primary',
'--secondary-color': '--textPrimary', // secondary mapped to textPrimary or maybe just primary or background. It was #FFF.
'--accent-color': '--primary'
};
const files = [
'pages/videos/index.md',
'static/style.css',
'static/carousel.js',
'pages/portfolio/index.md',
'notion/widget/social-media.html'
];
for (const file of files) {
const filePath = path.join(__dirname, file);
if (fs.existsSync(filePath)) {
let content = fs.readFileSync(filePath, 'utf8');
for (const [oldVar, newVar] of Object.entries(replacements)) {
content = content.split(oldVar).join(newVar);
}
fs.writeFileSync(filePath, content, 'utf8');
console.log(`Updated ${file}`);
}
}