'use strict'; var winston = require('winston'), nconf = require('nconf'), fs = require('fs'), path = require('path'), less = require('less'), crypto = require('crypto'), async = require('async'), cluster = require('cluster'), plugins = require('../plugins'), emitter = require('../emitter'), db = require('../database'); module.exports = function(Meta) { Meta.css = {}; Meta.css.cache = undefined; Meta.css.acpCache = undefined; Meta.css.branding = {}; Meta.css.defaultBranding = {}; Meta.css.minify = function(callback) { if (!cluster.isWorker || process.env.cluster_setup === 'true') { winston.verbose('[meta/css] Minifying LESS/CSS'); db.getObjectFields('config', ['theme:type', 'theme:id'], function(err, themeData) { var themeId = (themeData['theme:id'] || 'nodebb-theme-vanilla'), baseThemePath = path.join(nconf.get('themes_path'), (themeData['theme:type'] && themeData['theme:type'] === 'local' ? themeId : 'nodebb-theme-vanilla')), paths = [ baseThemePath, path.join(__dirname, '../../node_modules'), path.join(__dirname, '../../public/vendor/fontawesome/less'), path.join(__dirname, '../../public/vendor/bootstrap/less') ], source = '@import "font-awesome";', acpSource, x; plugins.lessFiles = filterMissingFiles(plugins.lessFiles); for(x=0; x