From 17dd113a947eedeb7c5aa9fc7209ae2ed3e1cfba Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 24 Mar 2014 15:35:58 -0400 Subject: [PATCH] fixed issue where plugin css and js wasn't loaded -- also less files no longer blow up --- src/meta.js | 5 ++--- src/plugins.js | 4 ++-- src/webserver.js | 23 +++++++++++++---------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/meta.js b/src/meta.js index c436f6c61b..83147eaeba 100644 --- a/src/meta.js +++ b/src/meta.js @@ -332,9 +332,8 @@ var fs = require('fs'), 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/fontawesome/fonts') + path.join(__dirname, '../node_modules'), + path.join(__dirname, '../public/vendor/fontawesome/less') ], source = '@import "./theme";\n@import "font-awesome";', x, numLESS, numCSS; diff --git a/src/plugins.js b/src/plugins.js index 2dd6608b5f..d915d347ab 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -109,7 +109,7 @@ var fs = require('fs'), Plugins.loadPlugin = function(pluginPath, callback) { fs.readFile(path.join(pluginPath, 'plugin.json'), function(err, data) { if (err) { - return callback(pluginPath.match('nodebb-theme') ? null : err); + return callback(pluginPath.match('nodebb-theme') ? null : err); } var pluginData = JSON.parse(data), @@ -164,7 +164,7 @@ var fs = require('fs'), Plugins.staticDirs[pluginData.id] = path.join(pluginPath, pluginData.staticDir); } - for(key in pluginData.staticDirs) { + for(var key in pluginData.staticDirs) { (function(mappedPath) { if (pluginData.staticDirs.hasOwnProperty(mappedPath)) { if (Plugins.staticDirs[mappedPath]) { diff --git a/src/webserver.js b/src/webserver.js index 12ad027fb6..debcf669ff 100644 --- a/src/webserver.js +++ b/src/webserver.js @@ -15,6 +15,7 @@ var path = require('path'), user = require('./user'), notifications = require('./notifications'), logger = require('./logger'), + plugins = require('./plugins'), middleware = require('./middleware'), routes = require('./routes'), emitter = require('./emitter'); @@ -86,17 +87,19 @@ if(nconf.get('ssl')) { winston.info('Using ports 80 and 443 is not recommend; use a proxy instead. See README.md'); } - // Prepare js for minification/concatenation - meta.js.prepare(function() { - if (app.enabled('minification')) { - meta.js.minify(); - } else { - meta.js.concatenate(); - } - }); + plugins.ready(function() { + // Prepare js for minification/concatenation + meta.js.prepare(function() { + if (app.enabled('minification')) { + meta.js.minify(); + } else { + meta.js.concatenate(); + } + }); - // Minify CSS - meta.css.minify(); + // Minify CSS + meta.css.minify(); + }); module.exports.server = server; module.exports.init = function () {