From bc11431fc9434568f95ab2bd774f2873723c91c8 Mon Sep 17 00:00:00 2001 From: Geoff Kimball Date: Wed, 8 Mar 2017 13:28:46 -0800 Subject: [PATCH] Fix {{ root }} variable having Windows path separators, closes #64 --- lib/processRoot.js | 5 +++-- package.json | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/processRoot.js b/lib/processRoot.js index 439ef3d..0491e08 100644 --- a/lib/processRoot.js +++ b/lib/processRoot.js @@ -1,4 +1,5 @@ var path = require('path'); +var slash = require('slash'); /** * Creates a string that can be prepended to a file path that needs to resolve to the root. @@ -16,7 +17,7 @@ module.exports = function(page, root) { relativePath += '/'; } - // On Windows, Node uses a "\" for the separator + // On Windows, paths are separated with a "\" // However, web browsers use "/" no matter the platform - return relativePath.replace('\\', '/'); + return slash(relativePath); } diff --git a/package.json b/package.json index 9ea7314..36af272 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "js-yaml": "^3.5.2", "marked": "^0.3.6", "nopt": "^4.0.1", + "slash": "^1.0.0", "through2": "^2.0.0", "vinyl-fs": "^2.4.4" },