From f194d127994faf8357bbb6d40749c3a339d87caf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20B=C3=B6hme?= Date: Mon, 30 Dec 2013 09:59:52 +0100 Subject: [PATCH] Fix 'extends' in browser. This fixes #370 This doesn't fix 'include' though. NOTE: this is merely for documentation purposes. I would consider #377 as a fix for 'extend' and 'include' in the browser. --- lib/swig.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/swig.js b/lib/swig.js index 4e315bcd..f930ec07 100644 --- a/lib/swig.js +++ b/lib/swig.js @@ -409,7 +409,11 @@ exports.Swig = function (opts) { parentFile = parentFile || options.filename; parentFile = path.resolve(path.dirname(parentFile), parentName); - parent = self.parseFile(parentFile, utils.extend({}, options, { filename: parentFile })); + if (cacheGet(parentFile) !== undefined) { + parent = cacheGet(parentFile); + } else { + parent = self.parseFile(parentFile, utils.extend({}, options, { filename: parentFile })); + } parentName = parent.parent; if (parentFiles.indexOf(parentFile) !== -1) {