From 7fb9c552dc1817f21a66d2c866a9d1c4b448f1db Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Fri, 17 Aug 2018 16:48:43 -0500 Subject: [PATCH] assetFileWrite no longer processes files corresponding to .js keys --- lib/pipeline/pipeline.js | 40 +++++++++------------------------------- 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/lib/pipeline/pipeline.js b/lib/pipeline/pipeline.js index 7ed665c40..bd2babc2f 100644 --- a/lib/pipeline/pipeline.js +++ b/lib/pipeline/pipeline.js @@ -114,7 +114,13 @@ class Pipeline { }, function assetFileWrite(next) { async.eachOf( - self.assetFiles, + // assetFileWrite should not process .js files + Object.keys(self.assetFiles) + .filter(key => !key.match(/\.js?$/)) + .reduce((obj, key) => { + obj[key] = self.assetFiles[key]; + return obj; + }, {}), function (files, targetFile, cb) { const isDir = targetFile.slice(-1) === '/' || targetFile.indexOf('.') === -1; // if it's not a directory @@ -125,36 +131,8 @@ class Pipeline { files, function (file, fileCb) { self.logger.trace("reading " + file.filename); - - // Not a JS file - if (file.filename.indexOf('.js') < 0) { - return file.content(function (fileContent) { - self.runPlugins(file, fileContent, fileCb); - }); - } - - // JS files - async.waterfall([ - function readFile(next) { - fs.readFile('./.embark/' + file.filename, (err, data) => { - if (err) { - return next(err); - } - next(null, data.toString()); - }); - }, - - function runPluginsOnContent(fileContent, next) { - self.runPlugins(file, fileContent, next); - } - - ], function (err, contentFile) { - if (err) { - self.logger.error(err.message || err); - return fileCb(err); - } - - fileCb(null, contentFile); + return file.content(function (fileContent) { + self.runPlugins(file, fileContent, fileCb); }); }, function (err, contentFiles) {