Created
March 10, 2020 07:40
-
-
Save kartiknair/008f35e05e0e71cfcef0f757b58acb2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const createPosts = posts => { | |
posts.forEach(post => { | |
if (!fs.existsSync(`${config.dev.outdir}/${post.path}`)) | |
fs.mkdirSync(`${config.dev.outdir}/${post.path}`); | |
fs.writeFile( | |
`${config.dev.outdir}/${post.path}/index.html`, | |
posthtml(post), | |
e => { | |
if (e) throw e; | |
console.log(`${post.path}/index.html was created successfully`); | |
} | |
); | |
}); | |
}; | |
module.exports = { | |
createPost: createPost, | |
createPosts: createPosts | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment