Skip to content

Commit

Permalink
feat: Improve rendering process with page parallel rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
kefranabg committed Feb 2, 2020
1 parent f083d8d commit 9dce835
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/@vuepress/core/lib/node/build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@ module.exports = class Build extends EventEmitter {
// render pages
logger.wait('Rendering static HTML...')

const pagePaths = []
const pagePathsPromises = []
for (const page of this.context.pages) {
pagePaths.push(await this.renderPage(page))
pagePathsPromises.push(this.renderPage(page))
}

const pagePaths = await Promise.all(pagePathsPromises)

readline.clearLine(process.stdout, 0)
readline.cursorTo(process.stdout, 0)

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

async renderPage (page) {
const pagePath = decodeURIComponent(page.path)
readline.clearLine(process.stdout, 0)
readline.cursorTo(process.stdout, 0)
process.stdout.write(`Rendering page: ${pagePath}`)

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

0 comments on commit 9dce835

Please sign in to comment.