From cac09e8fcd5d3316723e9b2b5a7b5bf46b0c64dc Mon Sep 17 00:00:00 2001 From: Matej Simek Date: Fri, 16 Aug 2019 15:59:30 +0200 Subject: [PATCH] templates: emulate __filename + __dirname globals --- lib/tasks/templates.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/tasks/templates.js b/lib/tasks/templates.js index ba92f850..5006f788 100644 --- a/lib/tasks/templates.js +++ b/lib/tasks/templates.js @@ -130,6 +130,9 @@ module.exports = function(gulp, config) { var name = path.basename(file.path) var data = _.cloneDeep(templatesData) + data.__filename = file.path + data.__dirname = path.dirname(file.path) + // In case of name == key, assign value as global object if(typeof templatesData[name] !== 'undefined') { var obj = _.assign(data, templatesData[name], file.data)