mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 10:35:55 +01:00
Refactor skins to be built on server-side (#6849)
* WIP * using bootswatch from npm instead of bootswatch CDN url * feat: on-demand client css building for skins * added ability for client-side to select a skin * updated loading and saving logic of bootstrapSkin on client side user settings * fix: broken test for #6849
This commit is contained in:
@@ -205,3 +205,15 @@ middleware.delayLoading = function (req, res, next) {
|
||||
|
||||
setTimeout(next, 1000);
|
||||
};
|
||||
|
||||
middleware.buildSkinAsset = function (req, res, next) {
|
||||
// If this middleware is reached, a skin was requested, so it is built on-demand
|
||||
var target = path.basename(req.originalUrl).match(/(client-[a-z]+)/);
|
||||
if (target) {
|
||||
meta.css.buildBundle(target[0], true, function () {
|
||||
next();
|
||||
});
|
||||
} else {
|
||||
setImmediate(next);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user