mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-05 02:14:35 +00:00
assetFileWrite no longer processes files corresponding to .js keys
This commit is contained in:
parent
0161a9b402
commit
7fb9c552dc
@ -114,7 +114,13 @@ class Pipeline {
|
|||||||
},
|
},
|
||||||
function assetFileWrite(next) {
|
function assetFileWrite(next) {
|
||||||
async.eachOf(
|
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) {
|
function (files, targetFile, cb) {
|
||||||
const isDir = targetFile.slice(-1) === '/' || targetFile.indexOf('.') === -1;
|
const isDir = targetFile.slice(-1) === '/' || targetFile.indexOf('.') === -1;
|
||||||
// if it's not a directory
|
// if it's not a directory
|
||||||
@ -125,36 +131,8 @@ class Pipeline {
|
|||||||
files,
|
files,
|
||||||
function (file, fileCb) {
|
function (file, fileCb) {
|
||||||
self.logger.trace("reading " + file.filename);
|
self.logger.trace("reading " + file.filename);
|
||||||
|
return file.content(function (fileContent) {
|
||||||
// Not a JS file
|
self.runPlugins(file, fileContent, fileCb);
|
||||||
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) {
|
function (err, contentFiles) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user