2016-01-15 06:08:54 -08:00
|
|
|
const challengesRegex = /^(bonfire|waypoint|zipline|basejump|checkpoint):\s/i;
|
2016-03-14 17:22:56 -07:00
|
|
|
import config from '../../webpack.config';
|
|
|
|
|
|
|
|
const __DEV__ = process.env.NODE_ENV !== 'production';
|
2016-01-15 06:08:54 -08:00
|
|
|
|
|
|
|
export default function jadeHelpers() {
|
|
|
|
return function jadeHelpersMiddleware(req, res, next) {
|
2016-01-18 15:15:09 -08:00
|
|
|
res.locals.removeOldTerms = function removeOldTerms(str = '') {
|
2016-01-15 06:08:54 -08:00
|
|
|
return str.replace(challengesRegex, '');
|
|
|
|
};
|
|
|
|
|
2016-03-14 17:22:56 -07:00
|
|
|
res.locals.getBundleLocation = function getBundleLocation() {
|
|
|
|
return __DEV__ ?
|
|
|
|
config.output.publicPath + '/bundle.js' :
|
|
|
|
'js/bundle.js';
|
|
|
|
};
|
|
|
|
|
2016-01-15 06:08:54 -08:00
|
|
|
next();
|
|
|
|
};
|
|
|
|
}
|