From d13872fffe1662a499d1181f762f21bc33117f3d Mon Sep 17 00:00:00 2001 From: Pierre Spring Date: Tue, 25 Nov 2014 13:49:37 +0100 Subject: [PATCH 1/2] Adds test for missing jade basedir --- test/fixtures/templates/extend.jade | 1 + test/templates.js | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 test/fixtures/templates/extend.jade diff --git a/test/fixtures/templates/extend.jade b/test/fixtures/templates/extend.jade new file mode 100644 index 000000000..d69ab9874 --- /dev/null +++ b/test/fixtures/templates/extend.jade @@ -0,0 +1 @@ +extend /index.jade \ No newline at end of file diff --git a/test/templates.js b/test/templates.js index 81e7d08a5..e051506b4 100644 --- a/test/templates.js +++ b/test/templates.js @@ -77,6 +77,18 @@ describe("templates", function(){ }) }) + it("should extend from a file with absolute path", function(done){ + poly.render("extend.jade", function(error, body){ + should.not.exist(error) + should.exist(body) + body.should.include("

Sintaxi

") + body.should.include("

Hello World

") + body.should.include("

Brock Whitten

") + body.should.include("

Vancouver

") + done() + }) + }) + }) }) From 865b771880b87f58efd61293387fa44382f2719f Mon Sep 17 00:00:00 2001 From: Pierre Spring Date: Tue, 25 Nov 2014 13:50:18 +0100 Subject: [PATCH 2/2] Fixes missing jade basedir --- lib/template/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/template/index.js b/lib/template/index.js index 1d037b2ab..d9bd1c5b9 100644 --- a/lib/template/index.js +++ b/lib/template/index.js @@ -144,7 +144,7 @@ var scope = module.exports = function(projectPath, partentLocals){ * note - layouts get the same scope as the partial * */ - var tmpl = processors[ext](fileContents, { filename: filePath }) + var tmpl = processors[ext](fileContents, { filename: filePath, basedir: projectPath }) try{ var render = tmpl.compile()