aboutsummaryrefslogtreecommitdiff
path: root/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'app.js')
-rw-r--r--app.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/app.js b/app.js
index f8e2ab5..b3beff9 100644
--- a/app.js
+++ b/app.js
@@ -27,9 +27,17 @@ var adminRoutes = require('./routes/admin');
// Templating engine, we are using handlebars
// This will allow us to create html pages dynamically before serving them.
-app.engine('.hbs', hbs({extname: '.hbs', defaultLayout: 'layout',
+// use the minifed css if the app running on production, otherwise use reg css
+var layout = (process.env.NODE_ENV == "production") ? 'layout' : 'layout_mini';
+app.engine(
+ '.hbs',
+ hbs({
+ extname: '.hbs',
+ defaultLayout: layout,
layoutsDir: __dirname + '/views/layouts/', // Set directory for base layout
- partialsDir: __dirname + '/views/partials'})); // Set directory for partials
+ partialsDir: __dirname + '/views/partials',
+ })
+); // Set directory for partials
app.set('views', path.join(__dirname, 'views')); // Our view path
app.set('view engine', 'hbs');
@@ -65,12 +73,13 @@ app.use(function(req, res, next) {
res.locals.session = req.session;
res.locals.user = req.user;
res.locals.messages = req.session.messages;
+ res.locals.config = (process.env.NODE_ENV == 'production') ? 'production' : null;
next();
});
-
+// app.locals.config = (process.env.NODE_ENV == 'production') ? 'production' : null;
// Allows us to customize express routing
// in a separate file.