mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 18:16:17 +01:00
added new --from-file flag that will load js/css from the precompiled file instead of recompiling it on startup
This commit is contained in:
@@ -99,6 +99,30 @@ module.exports = function(Meta) {
|
||||
});
|
||||
};
|
||||
|
||||
Meta.css.getFromFile = function(callback) {
|
||||
var cachePath = path.join(__dirname, '../../public/stylesheet.css'),
|
||||
acpCachePath = path.join(__dirname, '../../public/admin.css');
|
||||
fs.exists(cachePath, function(exists) {
|
||||
if (exists) {
|
||||
if (!cluster.isWorker || process.env.cluster_setup === 'true') {
|
||||
winston.info('[meta/css] (Experimental) Reading stylesheets from file');
|
||||
async.map([cachePath, acpCachePath], fs.readFile, function(err, files) {
|
||||
Meta.css.cache = files[0];
|
||||
Meta.css.acpCache = files[1];
|
||||
|
||||
emitter.emit('meta:css.compiled');
|
||||
callback();
|
||||
});
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
} else {
|
||||
winston.warn('[meta/css] (Experimental) No stylesheets found on disk, re-minifying');
|
||||
Meta.css.minify.apply(Meta.css, arguments);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function minify(source, paths, destination, callback) {
|
||||
var parser = new (less.Parser)({
|
||||
paths: paths
|
||||
|
||||
Reference in New Issue
Block a user