Skip to content
Browse files

fixed paths in pejs

  • Loading branch information...
1 parent 8d1dc60 commit 5bbcd3edd6f0a18fa839db21ddb19fcc75e0c389 @mafintosh mafintosh committed May 13, 2012
Showing with 9 additions and 3 deletions.
  1. +1 −1 app/index.html
  2. +7 −1 node_modules/pejs.js
  3. +1 −1 server.js
View
2 app/index.html
@@ -1,4 +1,4 @@
-<%- @render('./app/base.html') %>
+<%- @render('/base.html') %>
<%{ content %>
<div class='filler-120'></div>
<div class='component'>
View
8 node_modules/pejs.js
@@ -73,8 +73,12 @@ var template = function(locals, blocks) {
return _t;
};
-module.exports = function(options) {
+module.exports = function(root, options) {
+ root = root || '.';
+
var parse = function(filename, callback) {
+ var cwd = path.dirname(filename);
+
fs.readFile(filename, 'utf-8', function(err, src) {
if (err) return callback(err);
@@ -97,6 +101,8 @@ module.exports = function(options) {
var process = function(line) {
var map = {};
var save = function(_, filename) {
+ filename = path.join(filename[0] === '/' ? root : cwd, filename);
+
if (map[filename]) return map[filename];
waiting++;
View
2 server.js
@@ -11,7 +11,7 @@ var marked = require('marked');
var less = require('less');
var app = root();
-var template = pejs();
+var template = pejs('./app');
var GITHUB_ID = 'e411408f92365f7bbf0a';
var GITHUB_SECRET = '6795299bd3f3c24e7af6275f4483cd11e892c152';

0 comments on commit 5bbcd3e

Please sign in to comment.
Something went wrong with that request. Please try again.