mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
Don't use sync functions
This commit is contained in:
parent
a8776de913
commit
d5230accaf
@ -9,6 +9,7 @@ const { resolve, join, dirname } = require('path')
|
|||||||
const copy = pify(fs.copy)
|
const copy = pify(fs.copy)
|
||||||
const remove = pify(fs.remove)
|
const remove = pify(fs.remove)
|
||||||
const writeFile = pify(fs.writeFile)
|
const writeFile = pify(fs.writeFile)
|
||||||
|
const mkdirp = pify(fs.mkdirp)
|
||||||
|
|
||||||
const defaults = {
|
const defaults = {
|
||||||
dir: 'dist',
|
dir: 'dist',
|
||||||
@ -53,8 +54,10 @@ module.exports = function () {
|
|||||||
debug('Generate file: ' + path)
|
debug('Generate file: ' + path)
|
||||||
path = join(distPath, path)
|
path = join(distPath, path)
|
||||||
// Make sure the sub folders are created
|
// Make sure the sub folders are created
|
||||||
fs.mkdirsSync(dirname(path))
|
return co(function * () {
|
||||||
return writeFile(path, html, 'utf8')
|
yield mkdirp(dirname(path))
|
||||||
|
yield writeFile(path, html, 'utf8')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
promises.push(promise)
|
promises.push(promise)
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user