7 Star 0 Fork 2

fanrenji / vue-practice

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
update.js 813 Bytes
一键复制 编辑 原始数据 按行查看 历史
fanyouf 提交于 2020-10-16 21:43 . 添加一个静态模板
const fs = require('fs')
const files = fs.readdirSync('./src')
const filePath = files.map(item => {
return {
name: item,
path: `src/${item}/index.html`
}
})
var content = `
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
</style>
</head>
<body>
<div id="app">
$$$
</div>
</body>
</html>
`
var str = ["<h2>vue的一些小案例</h2>"]
str.push("<ul>")
filePath.forEach(item => {
str.push('<li>')
str.push(`<a href="./${item.path}">${item.name}</a>`)
str.push('</li>')
})
str.push('</ul>')
str.push(`<p>更新于${(new Date).toLocaleDateString()}`)
str.push('</p>')
str = str.join('')
content = content.replace('$$$', str)
fs.writeFileSync('./index.html',content)
JavaScript
1
https://gitee.com/fanyoufu2/vue-practice.git
git@gitee.com:fanyoufu2/vue-practice.git
fanyoufu2
vue-practice
vue-practice
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891