assetFileWrite no longer processes files corresponding to .js keys

This commit is contained in:
Michael Bradley, Jr 2018-08-17 16:48:43 -05:00
parent 0161a9b402
commit 7fb9c552dc

View File

@ -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,37 +131,9 @@ 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);
});
},
function (err, contentFiles) {
if (err) {