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:
Julian Lam
2018-11-07 13:44:35 -05:00
committed by GitHub
parent 84433f29ab
commit 501b3a79ca
11 changed files with 93 additions and 47 deletions

View File

@@ -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);
}
};