diff --git a/README.md b/README.md index 17d602a..02853a8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ```bash $ yarn install $ $Env:NODE_OPTIONS="--openssl-legacy-provider" -$ yarn build +$ yarn build; node make.js ``` 将 `./src/.vuepress/dist` 下文件夹上传到 `https://github.com/Digital-EDA/doc` \ No newline at end of file diff --git a/make.js b/make.js new file mode 100644 index 0000000..ce726b6 --- /dev/null +++ b/make.js @@ -0,0 +1,19 @@ +const fs = require('fs'); +const path = require('path'); + +function replaceInFiles(dir, searchStr, replaceStr) { + fs.readdirSync(dir).forEach(file => { + let filePath = path.join(dir, file); + let stats = fs.lstatSync(filePath); + + if (stats.isDirectory()) { + replaceInFiles(filePath, searchStr, replaceStr); + } else if (filePath.endsWith('.html')) { + let data = fs.readFileSync(filePath, 'utf8'); + let newData = data.replace(searchStr, replaceStr); + fs.writeFileSync(filePath, newData); + } + }); +} + +replaceInFiles('./src/.vuepress/dist', /\/videos\//g, '/doc/videos/'); \ No newline at end of file diff --git a/src/.vuepress/config.js b/src/.vuepress/config.js index 978b13a..d816ef7 100644 --- a/src/.vuepress/config.js +++ b/src/.vuepress/config.js @@ -1,7 +1,7 @@ const { description } = require('../../package') module.exports = { - base: './', + base: '/doc/', title: 'Digital-IDE', description: description, head: [