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) {
|
||||
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);
|
||||
};
|
||||
|
||||
@@ -217,11 +217,14 @@ middleware.buildSkinAsset = function (req, res, next) {
|
||||
async.waterfall([
|
||||
async.apply(plugins.prepareForBuild, ['client side styles']),
|
||||
async.apply(meta.css.buildBundle, target[0], true),
|
||||
function (next) {
|
||||
], function (err, css) {
|
||||
if (err) {
|
||||
return next();
|
||||
}
|
||||
|
||||
require('../meta/minifier').killAll();
|
||||
next();
|
||||
},
|
||||
], next);
|
||||
res.status(200).type('text/css').send(css);
|
||||
});
|
||||
} else {
|
||||
setImmediate(next);
|
||||
}
|
||||
|
||||
@@ -159,11 +159,6 @@ function addCoreRoutes(app, router, middleware, callback) {
|
||||
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) {
|
||||
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']);
|
||||
});
|
||||
|
||||
// Skins
|
||||
meta.css.supportedSkins.forEach(function (skin) {
|
||||
app.use(relativePath + '/assets/client-' + skin + '.css', middleware.buildSkinAsset);
|
||||
});
|
||||
|
||||
// only warn once
|
||||
var warned = new Set();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user