|
|
@ -24,6 +24,7 @@ module.exports = function(Meta) {
|
|
|
|
Meta.css.defaultBranding = {};
|
|
|
|
Meta.css.defaultBranding = {};
|
|
|
|
|
|
|
|
|
|
|
|
Meta.css.minify = function(callback) {
|
|
|
|
Meta.css.minify = function(callback) {
|
|
|
|
|
|
|
|
if (!cluster.isWorker || process.env.cluster_setup === 'true') {
|
|
|
|
winston.info('[meta/css] Minifying LESS/CSS');
|
|
|
|
winston.info('[meta/css] Minifying LESS/CSS');
|
|
|
|
db.getObjectFields('config', ['theme:type', 'theme:id'], function(err, themeData) {
|
|
|
|
db.getObjectFields('config', ['theme:type', 'theme:id'], function(err, themeData) {
|
|
|
|
var themeId = (themeData['theme:id'] || 'nodebb-theme-vanilla'),
|
|
|
|
var themeId = (themeData['theme:id'] || 'nodebb-theme-vanilla'),
|
|
|
@ -63,8 +64,26 @@ module.exports = function(Meta) {
|
|
|
|
function(next) {
|
|
|
|
function(next) {
|
|
|
|
minify(acpSource, paths, 'acpCache', next);
|
|
|
|
minify(acpSource, paths, 'acpCache', next);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
], callback);
|
|
|
|
], function(err, minified) {
|
|
|
|
|
|
|
|
// Propagate to other workers
|
|
|
|
|
|
|
|
if (cluster.isWorker) {
|
|
|
|
|
|
|
|
process.send({
|
|
|
|
|
|
|
|
action: 'css-propagate',
|
|
|
|
|
|
|
|
cache: minified[0],
|
|
|
|
|
|
|
|
acpCache: minified[1]
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (typeof callback === 'function') {
|
|
|
|
|
|
|
|
callback();
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (typeof callback === 'function') {
|
|
|
|
|
|
|
|
callback();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Meta.css.commitToFile = function(filename) {
|
|
|
|
Meta.css.commitToFile = function(filename) {
|
|
|
@ -123,7 +142,7 @@ module.exports = function(Meta) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (typeof callback === 'function') {
|
|
|
|
if (typeof callback === 'function') {
|
|
|
|
callback();
|
|
|
|
callback(null, css);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|