0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-27 22:59:51 -05:00

Added option to use a custom template for web UI

This commit is contained in:
Rafael Cesar 2015-02-25 19:15:36 -03:00 committed by Alex Kocharin
parent 0a38a704fe
commit 025e23627f
2 changed files with 8 additions and 3 deletions

View file

@ -19,6 +19,7 @@ web:
title: Sinopia
# logo: logo.png
# template: custom.hbs
auth:
htpasswd:

View file

@ -33,9 +33,13 @@ module.exports = function(config, auth, storage) {
Search.configureStorage(storage)
Handlebars.registerPartial('entry', fs.readFileSync(require.resolve('./GUI/entry.hbs'), 'utf8'))
var template = Handlebars.compile(fs.readFileSync(require.resolve('./GUI/index.hbs'), 'utf8'))
if(config.web && config.web.template) {
var template = Handlebars.compile(fs.readFileSync(config.web.template, 'utf8'));
}
else {
Handlebars.registerPartial('entry', fs.readFileSync(require.resolve('./GUI/entry.hbs'), 'utf8'))
var template = Handlebars.compile(fs.readFileSync(require.resolve('./GUI/index.hbs'), 'utf8'))
}
app.get('/', function(req, res, next) {
var base = config.url_prefix || req.protocol + '://' + req.get('host')
res.setHeader('Content-Type', 'text/html')