Permalink
Browse files

#123: fix EJS mod for windows, since it doesn't re-use pre-loaded deps

  • Loading branch information...
operatino committed Sep 20, 2015
1 parent 26d9abe commit 25d15c45836c259ac6a0675b930ab7580906124e
View
2 app.js
@@ -76,8 +76,6 @@ if (!commander.watch) {
/* App config */
require('./core/ejsHelpers');
// Version
app.use(function (req, res, next) {
res.header('X-powered-by', 'SourceJS ' + global.engineVersion);
View
@@ -1,6 +1,6 @@
var everyauth = require('everyauth');
var fs = require('fs');
var ejs = require('ejs');
var ejs = require('./ejsWithHelpers.js');
var path = require('path');
module.exports = function(app) {
@@ -40,7 +40,7 @@ var readFile = function (filePath, options) {
return fs.readFileSync(filePath, 'utf-8');
};
var includeMD = module.exports.includeMD = function(data, options){
var includeMD = function(data, options){
return function(mdPath){
if (!mdPath) return '';
@@ -64,7 +64,7 @@ var includeMD = module.exports.includeMD = function(data, options){
};
};
var includeFiles = module.exports.includeFiles = function(data, options){
var includeFiles = function(data, options){
return function(pattern){
if (!pattern) return '';
@@ -118,4 +118,7 @@ ejs.render = function(template, data, options){
}
return originalRenderer(template, data, options);
};
};
// Export modified EJS
module.exports = ejs;
@@ -6,8 +6,8 @@ var url = require('url');
var Q = require('q');
var _ = require('lodash');
var jsdom = require('jsdom');
var ejs = require('ejs');
var ejs = require(path.join(global.pathToApp, 'core/ejsWithHelpers.js'));
var trackStats = require(path.join(global.pathToApp, 'core/trackStats'));
var pathToApp = path.dirname(require.main.filename);
var specUtils = require(path.join(pathToApp, 'core/lib/specUtils'));
View
@@ -2,7 +2,8 @@
var fs = require('fs-extra');
var path = require('path');
var ejs = require('ejs');
var ejs = require(path.join(global.pathToApp, 'core/ejsWithHelpers.js'));
var specUtils = require(path.join(global.pathToApp,'core/lib/specUtils'));
var configUtils = require(path.join(global.pathToApp,'core/lib/configUtils'));
View
@@ -1,12 +1,13 @@
'use strict';
var fs = require('fs-extra');
var ejs = require('ejs');
var path = require('path');
var cheerio = require('cheerio');
var ejs = require(path.join(global.pathToApp, 'core/ejsWithHelpers.js'));
var viewResolver = require(path.join(global.pathToApp + '/core/lib/viewResolver.js'));
var getHeaderAndFooter = require(global.pathToApp + '/core/headerFooter.js').getHeaderAndFooter;
var specUtils = require(path.join(global.pathToApp,'core/lib/specUtils'));
var cheerio = require('cheerio');
/**
* Wrap rendered html from request with spec wrapper (header, footer, etc.)
@@ -1,13 +1,12 @@
var path = require('path');
var ejs = require('ejs');
var expect = require('chai').expect;
var pathToMasterApp = path.resolve('./');
var ejs = require(path.join(pathToMasterApp, 'core/ejsWithHelpers.js'));
var loadOptions = require(path.join(pathToMasterApp, 'core/loadOptions'));
global.opts = loadOptions(path.resolve(pathToMasterApp));
require(path.join(pathToMasterApp, 'core/ejsHelpers'));
describe('includeMD', function () {
it('should properly include Markdown file', function (done) {
var result = ejs.render('<%- includeMD("partials/markdown") %>', {

0 comments on commit 25d15c4

Please sign in to comment.