mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-24 01:10:31 +01:00
theme intergration into nodebb based on config hash value
This commit is contained in:
@@ -28,7 +28,7 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="{relative_path}/css/nodebb.css" />
|
<link rel="stylesheet" type="text/css" href="{relative_path}/css/theme.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ var express = require('express'),
|
|||||||
prefix: nconf.get('relative_path'),
|
prefix: nconf.get('relative_path'),
|
||||||
yuicompress: true
|
yuicompress: true
|
||||||
}));
|
}));
|
||||||
app.use(nconf.get('relative_path'), express.static(path.join(__dirname, '../', 'public')));
|
|
||||||
app.use(express.bodyParser()); // Puts POST vars in request.body
|
app.use(express.bodyParser()); // Puts POST vars in request.body
|
||||||
app.use(express.cookieParser()); // If you want to parse cookies (res.cookies)
|
app.use(express.cookieParser()); // If you want to parse cookies (res.cookies)
|
||||||
app.use(express.session({
|
app.use(express.session({
|
||||||
@@ -131,20 +130,44 @@ var express = require('express'),
|
|||||||
next();
|
next();
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
// Static Directories for NodeBB Plugins
|
async.parallel([
|
||||||
plugins.ready(function () {
|
function(next) {
|
||||||
for (d in plugins.staticDirs) {
|
// Static Directories for NodeBB Plugins
|
||||||
app.use(nconf.get('relative_path') + '/plugins/' + d, express.static(plugins.staticDirs[d]));
|
plugins.ready(function () {
|
||||||
if (process.env.NODE_ENV === 'development') winston.info('Static directory routed for plugin: ' + d);
|
for (d in plugins.staticDirs) {
|
||||||
}
|
app.use(nconf.get('relative_path') + '/plugins/' + d, express.static(plugins.staticDirs[d]));
|
||||||
|
if (process.env.NODE_ENV === 'development') winston.info('Static directory routed for plugin: ' + d);
|
||||||
|
}
|
||||||
|
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
function(next) {
|
||||||
|
RDB.hmget('config', 'theme:type', 'theme:id', function(err, themeData) {
|
||||||
|
if (!themeData[0] || themeData[0] === 'local') {
|
||||||
|
var themeId = (themeData[1] || 'nodebb-theme-vanilla');
|
||||||
|
if (process.env.NODE_ENV === 'development') winston.info('[themes] Using theme ' + themeId);
|
||||||
|
|
||||||
|
app.use(require('less-middleware')({
|
||||||
|
src: path.join(__dirname, '../node_modules/' + themeId),
|
||||||
|
dest: path.join(__dirname, '../public/css'),
|
||||||
|
prefix: nconf.get('relative_path') + '/css',
|
||||||
|
yuicompress: true
|
||||||
|
}));
|
||||||
|
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
], next);
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
// Router & post-router middlewares
|
// Router & post-router middlewares
|
||||||
app.use(app.router);
|
app.use(app.router);
|
||||||
|
|
||||||
|
// Static directory /public
|
||||||
|
app.use(nconf.get('relative_path'), express.static(path.join(__dirname, '../', 'public')));
|
||||||
|
|
||||||
// 404 catch-all
|
// 404 catch-all
|
||||||
app.use(function (req, res, next) {
|
app.use(function (req, res, next) {
|
||||||
res.status(404);
|
res.status(404);
|
||||||
|
|||||||
Reference in New Issue
Block a user