Skip to content

Commit 9dce835

Browse files
committed
feat: Improve rendering process with page parallel rendering
1 parent f083d8d commit 9dce835

File tree

1 file changed

+4
-5
lines changed
  • packages/@vuepress/core/lib/node/build

1 file changed

+4
-5
lines changed

packages/@vuepress/core/lib/node/build/index.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,13 @@ module.exports = class Build extends EventEmitter {
8989
// render pages
9090
logger.wait('Rendering static HTML...')
9191

92-
const pagePaths = []
92+
const pagePathsPromises = []
9393
for (const page of this.context.pages) {
94-
pagePaths.push(await this.renderPage(page))
94+
pagePathsPromises.push(this.renderPage(page))
9595
}
9696

97+
const pagePaths = await Promise.all(pagePathsPromises)
98+
9799
readline.clearLine(process.stdout, 0)
98100
readline.cursorTo(process.stdout, 0)
99101

@@ -134,9 +136,6 @@ module.exports = class Build extends EventEmitter {
134136

135137
async renderPage (page) {
136138
const pagePath = decodeURIComponent(page.path)
137-
readline.clearLine(process.stdout, 0)
138-
readline.cursorTo(process.stdout, 0)
139-
process.stdout.write(`Rendering page: ${pagePath}`)
140139

141140
// #565 Avoid duplicate description meta at SSR.
142141
const meta = (page.frontmatter && page.frontmatter.meta || []).filter(item => item.name !== 'description')

0 commit comments

Comments
 (0)