'use strict';

var express = require('express');
var favicon = require('serve-favicon');
var path = require('path');

module.exports = function(app, baseDir, config) {
    var env = app.get('env');
    var servedDirectory = 'app';

    if ('development' === env) {
        app.use(config.baseUrl, express.static(path.join(__dirname, '.tmp')));
    }

    if ('production' === env) {
        // prerender.io
        app.use(require('prerender-node').set('prerenderToken', process.env.PRERENDER_TOKEN).set('protocol', 'https'));

        servedDirectory = 'dist';
        app.use(favicon(path.join(__dirname, 'dist', 'favicon.ico')));
    }

    app.use(config.baseUrl, express.static(path.join(__dirname, servedDirectory)));
    app.use(config.baseUrl + '/scripts/template.js', express.static(path.join(baseDir, config.scenarioTemplate)));
    app.use(config.baseUrl + '/scripts/constants.js', express.static(path.join(baseDir, config.constants)));

    app.get(config.baseUrl + '/scripts/server-config.js', function (req, res) {
        res.type('application/javascript').send('window.serverConfig = ' + JSON.stringify(config.serverConfig || {}) + ';');
    });

    app.route(config.baseUrl + '/*').get(function(req, res) {
        res.sendFile(path.join(__dirname, servedDirectory, 'index.html'));
    });
};

@@ -229,127 +229,8 @@
 ';%0A%0A
-    if ('development' === env) %7B%0A        app.use(config.baseUrl, express.static(path.join(__dirname, '.tmp')));%0A    %7D%0A%0A
     
@@ -512,16 +512,229 @@
 );%0A    %7D
+ else %7B%0A        app.use(config.baseUrl + '/styles', express.static(path.join(__dirname, '.tmp', 'styles')));  // ugly hack to serve compiled SCSS; you will need to %60grunt build%60 every time you change a style%0A    %7D
 %0A%0A    ap

Make styles-serving hack more specific