update
parent
a4841af052
commit
5e6fc26bd3
13
lib/prod.js
13
lib/prod.js
|
@ -8,7 +8,7 @@ const noc = Buffer.from('')
|
|||
export default function compile(root = '', dist = '', conf = {}) {
|
||||
//
|
||||
const IS_MPA = Object.keys(conf.pages).length > 1
|
||||
|
||||
let timeStart = Date.now()
|
||||
let html = fs.cat(join(process.env.PWD, 'index.html')).toString()
|
||||
|
||||
let pagesDir = '',
|
||||
|
@ -26,6 +26,8 @@ export default function compile(root = '', dist = '', conf = {}) {
|
|||
currentPage = Object.keys(conf.pages)[0]
|
||||
page = conf.pages[currentPage]
|
||||
|
||||
console.log('正在生成 %s...', `${currentPage}.html`)
|
||||
|
||||
for (let it of list) {
|
||||
// 入口文件, 特殊处理
|
||||
if (it.path === page.entry) {
|
||||
|
@ -35,10 +37,11 @@ export default function compile(root = '', dist = '', conf = {}) {
|
|||
let code = parseHtml(html, { page, imports: conf.imports, entry })
|
||||
|
||||
fs.echo(code, join(dist, `${currentPage}.html`))
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
console.log(' 解析 %s...', it.name)
|
||||
|
||||
switch (it.ext) {
|
||||
case '.vue':
|
||||
{
|
||||
|
@ -80,7 +83,13 @@ export default function compile(root = '', dist = '', conf = {}) {
|
|||
fs.echo(code, join(dist, it.name))
|
||||
}
|
||||
break
|
||||
|
||||
default:
|
||||
fs.cp(it.path, join(dist, it.name))
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log('\n页面处理完成, 耗时 %ss\n', (Date.now() - timeStart) / 1000)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue