-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_htmls.js
More file actions
22 lines (21 loc) · 837 Bytes
/
Copy pathupdate_htmls.js
File metadata and controls
22 lines (21 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import fs from 'fs';
const files = [
'src/componentes/formulario/formulario.html',
'src/componentes/acerca/demo-acerca.html',
'src/componentes/demo-shopping-list/demo-shopping-list.html',
'src/componentes/configuracion/demo-config.html',
'src/componentes/admin-logs/admin-logs.html',
'src/componentes/perfil/perfil.html'
];
for(let file of files) {
if (fs.existsSync(file)) {
let content = fs.readFileSync(file, 'utf8');
content = content.replace(/<mita-code-editor([^>]*)>\n([\s\S]*?)<\/mita-code-editor>/g, (match, attrs, code) => {
// Don't wrap if already wrapped
if (code.includes('<pre><code>')) return match;
return `<mita-code-editor${attrs}>\n <pre><code>${code}</code></pre>\n</mita-code-editor>`;
});
fs.writeFileSync(file, content);
console.log(`Updated ${file}`);
}
}