From e23c41988015d4348dff609b0a73762ddc3e64f8 Mon Sep 17 00:00:00 2001 From: Geoff Kimball Date: Mon, 7 Dec 2015 14:53:51 -0800 Subject: [PATCH] Fix the root variable using the wrong slashes on Windows, zurb/foundation-sites#7435 --- lib/loadHelpers.js | 5 +++-- lib/processRoot.js | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/loadHelpers.js b/lib/loadHelpers.js index 819c46d..4ff6319 100644 --- a/lib/loadHelpers.js +++ b/lib/loadHelpers.js @@ -14,10 +14,11 @@ module.exports = function(dir) { var name = path.basename(helpers[i], '.js'); try { - if(this.Handlebars.helpers[name]){ + if (this.Handlebars.helpers[name]){ delete require.cache[require.resolve(path.join(helpers[i]))]; this.Handlebars.unregisterHelper(name); } + helper = require(path.join(helpers[i])); this.Handlebars.registerHelper(name, helper); } @@ -25,4 +26,4 @@ module.exports = function(dir) { console.warn('Error when loading ' + name + '.js as a Handlebars helper.'); } } -} \ No newline at end of file +} diff --git a/lib/processRoot.js b/lib/processRoot.js index 235f6dc..439ef3d 100644 --- a/lib/processRoot.js +++ b/lib/processRoot.js @@ -16,5 +16,7 @@ module.exports = function(page, root) { relativePath += '/'; } - return relativePath; + // On Windows, Node uses a "\" for the separator + // However, web browsers use "/" no matter the platform + return relativePath.replace('\\', '/'); }