diff options
| author | kdam0 <kumar.damani@mail.utoronto.ca> | 2017-04-15 01:16:07 +0000 |
|---|---|---|
| committer | kdam0 <kumar.damani@mail.utoronto.ca> | 2017-04-15 01:16:07 +0000 |
| commit | bd692ffbc8327c2ae6bec1376554ae569eb44e88 (patch) | |
| tree | bb3275bb9e681165a642cf22c2e4c89e615d7219 /app.js | |
| parent | c1bcbbec851d509ee911016536a5e684eac4ee43 (diff) | |
now using minified css on production.
Diffstat (limited to 'app.js')
| -rw-r--r-- | app.js | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -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. |
