From a44e977d7dd0b356476e02030d6618c55dca6e12 Mon Sep 17 00:00:00 2001 From: mean-cj Date: Sat, 17 Dec 2016 02:29:37 +0700 Subject: [PATCH] start with ./ auto include file from absolute path if require or include inner script when i start with "./" i wan't to auto include file from absolute path, Example. //= require ./resources/script/test.js output /home/username/domains/domain.com/public_html/resources/script/test.js your option includePath is not support with this string "./" --- index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index b82001b..e3a4035 100644 --- a/index.js +++ b/index.js @@ -150,8 +150,12 @@ module.exports = function (params) { fileMatches = fileMatches.concat(globResults); } }else{ - // Otherwise search relatively - includePath = relativeBasePath + "/" + split[1]; + // Otherwise search relatively + if( split[1].substr(0,2) == './' ) + includePath = path.resolve('.') + "" + split[1].substr(1); + else + includePath = relativeBasePath + "/" + split[1]; + var globResults = glob.sync(includePath, {mark: true}); fileMatches = globResults; }