From 325e3f265f2032a78f19fd0d2f00b26aa3852cd6 Mon Sep 17 00:00:00 2001 From: Andreas Richter Date: Mon, 6 Aug 2012 13:54:14 -0400 Subject: [PATCH] Fix package node version (testing npm install) Prevent stylus middle tier if the current theme has no stylus folder. --- app.js | 34 ++++++++++++++++++---------------- package.json | 4 ++-- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/app.js b/app.js index bfc868e14..3c0c01316 100644 --- a/app.js +++ b/app.js @@ -153,22 +153,24 @@ function bootApplication(next) { // Load placeholder, replaced later if(app.config.get('libraries:stylus:enabled')) { - app.mwHelpers.stylusMiddleware = function (themePath) { - var mw = stylus.middleware({ - src: themePath + '/stylus', - dest: themePath + '/public', - debug: false, - compile: function (str, path) { // optional, but recommended - return stylus(str) - .set('filename', path) - .set('warn', app.config.get('libraries:stylus:warn')) - .set('compress', app.config.get('libraries:stylus:compress')); - } - }); - mw.tag = 'theme.stylus'; - return mw; - }; - app.use(app.mwHelpers.stylusMiddleware('')); + if ((fs.existsSync || path.existsSync)(themePatch + '/stylus')) { + app.mwHelpers.stylusMiddleware = function (themePath) { + var mw = stylus.middleware({ + src: themePath + '/stylus', + dest: themePath + '/public', + debug: false, + compile: function (str, path) { // optional, but recommended + return stylus(str) + .set('filename', path) + .set('warn', app.config.get('libraries:stylus:warn')) + .set('compress', app.config.get('libraries:stylus:compress')); + } + }); + mw.tag = 'theme.stylus'; + return mw; + }; + app.use(app.mwHelpers.stylusMiddleware('')); + } } // Static app.mwHelpers.staticMiddleware = function (themePath) { diff --git a/package.json b/package.json index 37621c7a5..ce07d3b59 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "calipso", "description": "A NodeJS CMS", - "version": "0.3.0", + "version": "0.3.1", "homepage": "http://calip.so", "repository": { "type": "git", @@ -18,7 +18,7 @@ "tests": "./tests" }, "engines": { - "node": "0.6.x" + "node": ">=0.6||>=0.8" }, "devDependencies": { "mocha": "*",