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

29 lines
769 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 = (supportedLanguages, templatesPath, destinationPath) => {
fs.mkdirSync(`${destinationPath}/.vuepress`)
fs.mkdirSync(`${destinationPath}/.vuepress/public`)
2020-11-27 12:45:16 +00:00
fs.copyFileSync(
`${templatesPath}/.vuepress/public/favicon.ico`,
`${destinationPath}/.vuepress/public/favicon.ico`
)
2020-11-27 12:45:16 +00:00
const vuepressConfig = fs.readFileSync(
`${templatesPath}/.vuepress/config.yml.handlebars`,
'utf8'
)
const vuepressConfigContent = Handlebars.compile(vuepressConfig)(
supportedLanguages
)
fs.writeFileSync(
`${destinationPath}/.vuepress/config.yml`,
vuepressConfigContent
)
}