Skip to content

Commit

Permalink
feat(preprocessor): Allow preprocessor to handle binary files
Browse files Browse the repository at this point in the history
  • Loading branch information
kyliau committed Jun 15, 2018
1 parent 05dd09a commit a1478bd
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,7 @@ function createPreprocessor (config, basePath, injector) {
var preprocessorNames = []
for (var i = 0; i < patterns.length; i++) {
if (mm(file.originalPath, patterns[i], {dot: true})) {
if (thisFileIsBinary) {
log.warn('Ignoring preprocessing (%s) %s because it is a binary file.',
config[patterns[i]].join(', '), file.originalPath)
} else {
preprocessorNames = combineLists(preprocessorNames, config[patterns[i]])
}
preprocessorNames = combineLists(preprocessorNames, config[patterns[i]])
}
}

Expand All @@ -125,7 +120,12 @@ function createPreprocessor (config, basePath, injector) {
}

instances[name] = p
preprocessors.push(p)
if (!thisFileIsBinary || p.handleBinaryFiles) {
preprocessors.push(p)
} else {
log.warn('Ignoring preprocessing (%s) %s because it is a binary file.',
name, file.originalPath)
}
})

nextPreprocessor(null, thisFileIsBinary ? buffer : buffer.toString())
Expand Down

0 comments on commit a1478bd

Please sign in to comment.