Skip to content

Commit

Permalink
Don't use sync functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Atinux committed Nov 10, 2016
1 parent a8776de commit d5230ac
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const { resolve, join, dirname } = require('path')
const copy = pify(fs.copy)
const remove = pify(fs.remove)
const writeFile = pify(fs.writeFile)
const mkdirp = pify(fs.mkdirp)

const defaults = {
dir: 'dist',
Expand Down Expand Up @@ -53,8 +54,10 @@ module.exports = function () {
debug('Generate file: ' + path)
path = join(distPath, path)
// Make sure the sub folders are created
fs.mkdirsSync(dirname(path))
return writeFile(path, html, 'utf8')
return co(function * () {
yield mkdirp(dirname(path))
yield writeFile(path, html, 'utf8')
})
})
promises.push(promise)
})
Expand Down

0 comments on commit d5230ac

Please sign in to comment.