加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build-html.js 1.74 KB
一键复制 编辑 原始数据 按行查看 历史
/* eslint-env node */
const fs = require('fs');
fs.readFile('editor/svg-editor-es.html', 'utf8', (err, data) => {
if (err) {
console.log('Error reading `svg-editor-es.html` file', err);
return;
}
data = data
.replace(
'<!DOCTYPE html>',
`<!DOCTYPE html>
<!-- AUTO-GENERATED FROM svg-editor-es.html; DO NOT EDIT; use build-html.js to build -->`
).replace(
'<script type="module" src="redirect-on-lacking-support.js"></script>',
'<script defer="defer" src="../dist/redirect-on-lacking-support.js"></script>'
).replace(
'<script type="module" src="../svgedit-config-es.js"></script>',
'<script defer="defer" src="../svgedit-config-iife.js"></script>'
).replace(
'<script src="external/dom-polyfill/dom-polyfill.js"></script>',
'<script src="../dist/dom-polyfill.js"></script>'
);
fs.writeFile('editor/svg-editor.html', data, (err) => {
if (err) {
console.log('Error writing file', err);
return;
}
console.log('Completed file rewriting!');
});
});
fs.readFile('editor/extensions/imagelib/index-es.html', 'utf8', (err, data) => {
if (err) {
console.log('Error reading `imagelib/index-es.html` file', err);
return;
}
data = data
.replace(
'<!DOCTYPE html>',
`<!DOCTYPE html>
<!-- AUTO-GENERATED FROM imagelib/index-es.html; DO NOT EDIT; use build-html.js to build -->`
).replace(
'<script type="module" src="index.js"></script>',
'<script defer="defer" src="../../../dist/extensions/imagelib/index.js"></script>'
);
fs.writeFile('editor/extensions/imagelib/index.html', data, (err) => {
if (err) {
console.log('Error writing file', err);
return;
}
console.log('Completed file rewriting!');
});
});
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化