Skip to content

Commit

Permalink
Simplify syntax for setting of assets middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
fyockm committed Jun 16, 2014
1 parent 1f644d7 commit ccf1b95
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions server/config/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var express = require('express'),
flash = require('connect-flash'),
helpers = require('view-helpers'),
config = require('./config'),
assets = require('./assets.json'),
expressValidator = require('express-validator'),
appPath = process.cwd(),
util = require('meanio/lib/util'),
Expand Down Expand Up @@ -70,16 +71,13 @@ module.exports = function(app, passport, db) {
app.use(bodyParser());
app.use(methodOverride());

// Import the assets file
var assets = assetmanager.process({
assets: require('./assets.json'),
debug: (process.env.NODE_ENV !== 'production'),
webroot: 'public/public'
});

// Add assets to local variables
// Import the assets file and add to locals
app.use(function(req, res, next) {
res.locals.assets = assets;
res.locals.assets = assetmanager.process({
assets: assets,
debug: process.env.NODE_ENV !== 'production',
webroot: 'public/public'
});
next();
});

Expand Down

0 comments on commit ccf1b95

Please sign in to comment.