Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Pull some less middleware config out into the environmental config files

  • Loading branch information...
commit 96341915755b555616eb6e7509fe2d34bd60a05c 1 parent c2c00ac
@stenington stenington authored
Showing with 18 additions and 10 deletions.
  1. +14 −0 lib/environments/local-dist.js
  2. +4 −10 middleware.js
View
14 lib/environments/local-dist.js
@@ -48,4 +48,18 @@ exports.config = {
path: '/verify'
},
+ // LESS/CSS compilation settings
+ // Additional options: https://github.com/emberfeather/less.js-middleware#options
+ // Recommended PRODUCTION settings:
+ // less: {
+ // once: true,
+ // compress: true,
+ // force: false
+ // }
+ less: {
+ once: false,
+ compress: "auto",
+ force: true
+ }
+
}
View
14 middleware.js
@@ -6,6 +6,7 @@ var crypto = require('crypto');
var User = require('./models/user');
var path = require('path');
var lessMiddleware = require('less-middleware');
+var _ = require('underscore');
// `COOKIE_SECRET` is randomly generated on the first run of the server,
// then stored to a file and looked up on restart to maintain state.
@@ -162,21 +163,14 @@ exports.notFound = function notFound() {
};
exports.less = function less(env) {
- var config = {
+ var base = {
src: path.join(__dirname, "static/less"),
paths: [path.join(__dirname, "static/vendor/bootstrap/less")],
dest: path.join(__dirname, "static/css"),
prefix: '/css',
- /* default to production settings */
- once: true,
- compress: true
};
- if ('development' === env) {
- config.once = false;
- config.compress = "auto";
- config.force = true;
- }
- return lessMiddleware(config);
+ var config = configuration.get('less') || {};
+ return lessMiddleware(_.defaults(base, config));
};
var utils = exports.utils = {};
Please sign in to comment.
Something went wrong with that request. Please try again.