macos-defaults/build/vuepress/write-homepage.js

18 lines
493 B
JavaScript
Raw Normal View History

const fs = require('fs')
const Handlebars = require('handlebars')
2020-10-03 13:41:02 +00:00
Handlebars.registerHelper('lowerCase', (string) => {
return string.toLowerCase()
})
module.exports = (defaults, templatesPath, destinationPath) => {
fs.mkdirSync(destinationPath)
2020-11-27 12:45:16 +00:00
const homeTemplate = fs.readFileSync(
`${templatesPath}/home.md.handlebars`,
'utf8'
)
const rootReadmeContent = Handlebars.compile(homeTemplate)(defaults)
fs.writeFileSync(`${destinationPath}/readme.md`, rootReadmeContent)
}