Moving Mustache templates content in separate files.

This commit is contained in:
John Livingston
2023-09-22 13:56:48 +02:00
parent b5140ca994
commit 679baf024c
6 changed files with 230 additions and 219 deletions

View File

@ -35,10 +35,23 @@ function loadLocs() {
return r
}
function loadMustaches () {
// Loading mustache templates, dans filling constants.
const r = []
r['MUSTACHE_CONFIGURATION_HOME'] = loadMustache('client/common/configuration/templates/home.mustache')
r['MUSTACHE_CONFIGURATION_CHANNEL'] = loadMustache('client/common/configuration/templates/channel.mustache')
return r
}
function loadMustache (file) {
const filePath = path.resolve(__dirname, file)
return JSON.stringify(fs.readFileSync(filePath).toString())
}
const define = Object.assign({
PLUGIN_CHAT_PACKAGE_NAME: JSON.stringify(packagejson.name),
PLUGIN_CHAT_SHORT_NAME: JSON.stringify(packagejson.name.replace(/^peertube-plugin-/, ''))
}, loadLocs())
}, loadLocs(), loadMustaches())
const configs = clientFiles.map(f => ({
entryPoints: [ path.resolve(__dirname, 'client', f + '.ts') ],