mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: #7071 buildSkinAsset won't rebuild continuously
This commit is contained in:
@@ -206,7 +206,9 @@ CSS.buildBundle = function (target, fork, callback) {
|
|||||||
function (bundle, next) {
|
function (bundle, next) {
|
||||||
var filename = target + '.css';
|
var filename = target + '.css';
|
||||||
|
|
||||||
fs.writeFile(path.join(__dirname, '../../build/public', filename), bundle.code, next);
|
fs.writeFile(path.join(__dirname, '../../build/public', filename), bundle.code, function (err) {
|
||||||
|
next(err, bundle.code);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
], callback);
|
], callback);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -217,11 +217,14 @@ middleware.buildSkinAsset = function (req, res, next) {
|
|||||||
async.waterfall([
|
async.waterfall([
|
||||||
async.apply(plugins.prepareForBuild, ['client side styles']),
|
async.apply(plugins.prepareForBuild, ['client side styles']),
|
||||||
async.apply(meta.css.buildBundle, target[0], true),
|
async.apply(meta.css.buildBundle, target[0], true),
|
||||||
function (next) {
|
], function (err, css) {
|
||||||
require('../meta/minifier').killAll();
|
if (err) {
|
||||||
next();
|
return next();
|
||||||
},
|
}
|
||||||
], next);
|
|
||||||
|
require('../meta/minifier').killAll();
|
||||||
|
res.status(200).type('text/css').send(css);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
setImmediate(next);
|
setImmediate(next);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,11 +159,6 @@ function addCoreRoutes(app, router, middleware, callback) {
|
|||||||
statics.unshift({ route: '/assets/uploads', path: nconf.get('upload_path') });
|
statics.unshift({ route: '/assets/uploads', path: nconf.get('upload_path') });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skins
|
|
||||||
meta.css.supportedSkins.forEach(function (skin) {
|
|
||||||
app.use(relativePath + '/assets/client-' + skin + '.css', middleware.buildSkinAsset);
|
|
||||||
});
|
|
||||||
|
|
||||||
statics.forEach(function (obj) {
|
statics.forEach(function (obj) {
|
||||||
app.use(relativePath + obj.route, middleware.trimUploadTimestamps, express.static(obj.path, staticOptions));
|
app.use(relativePath + obj.route, middleware.trimUploadTimestamps, express.static(obj.path, staticOptions));
|
||||||
});
|
});
|
||||||
@@ -171,6 +166,11 @@ function addCoreRoutes(app, router, middleware, callback) {
|
|||||||
res.redirect(relativePath + '/assets/uploads' + req.path + '?' + meta.config['cache-buster']);
|
res.redirect(relativePath + '/assets/uploads' + req.path + '?' + meta.config['cache-buster']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Skins
|
||||||
|
meta.css.supportedSkins.forEach(function (skin) {
|
||||||
|
app.use(relativePath + '/assets/client-' + skin + '.css', middleware.buildSkinAsset);
|
||||||
|
});
|
||||||
|
|
||||||
// only warn once
|
// only warn once
|
||||||
var warned = new Set();
|
var warned = new Set();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user