mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 12:36:02 +01:00
themes - added ability to route custom templates
This commit is contained in:
@@ -120,9 +120,8 @@ var utils = require('./../public/src/utils.js'),
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
function(config, next) {
|
function(config, next) {
|
||||||
if (config.staticDir) {
|
themeData['theme:staticDir'] = config.staticDir ? config.staticDir : false;
|
||||||
themeData['theme:staticDir'] = config.staticDir;
|
themeData['theme:templates'] = config.templates ? config.templates : false;
|
||||||
}
|
|
||||||
|
|
||||||
RDB.hmset('config', themeData, next);
|
RDB.hmset('config', themeData, next);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ var express = require('express'),
|
|||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
// Theme configuration
|
// Theme configuration
|
||||||
RDB.hmget('config', 'theme:type', 'theme:id', 'theme:staticDir', function(err, themeData) {
|
RDB.hmget('config', 'theme:type', 'theme:id', 'theme:staticDir', 'theme:templates', function(err, themeData) {
|
||||||
var themeId = (themeData[1] || 'nodebb-theme-vanilla');
|
var themeId = (themeData[1] || 'nodebb-theme-vanilla');
|
||||||
|
|
||||||
// Detect if a theme has been selected, and handle appropriately
|
// Detect if a theme has been selected, and handle appropriately
|
||||||
@@ -183,6 +183,13 @@ var express = require('express'),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (themeData[3]) {
|
||||||
|
app.use('/templates', express.static(path.join(__dirname, '../node_modules', themeData[1], themeData[3])));
|
||||||
|
if (process.env.NODE_ENV === 'development') {
|
||||||
|
winston.info('Custom templates directory routed for theme: ' + themeData[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
app.use(require('less-middleware')({
|
app.use(require('less-middleware')({
|
||||||
src: path.join(__dirname, '../node_modules/' + themeId),
|
src: path.join(__dirname, '../node_modules/' + themeId),
|
||||||
dest: path.join(__dirname, '../public/css'),
|
dest: path.join(__dirname, '../public/css'),
|
||||||
|
|||||||
Reference in New Issue
Block a user