Add new API method for failing build upon validation error #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a minor usability improvement intended for scenarios where the user wishes to fail the build if a validation error occurs and there is no need to further process the stream after validation. I followed the example of numerous other Gulp plugins and simply added a new API method named
failOnError()
to which the stream can be piped if the user desires to fail the build upon validation error. Providing such an API allows the user to easily fail the build without having to add the boilerplate currently documented in readme.md. As the build failure trigger is not coupled tovalidate()
, it does not prevent the user from continuing to process the stream if they choose.Note that this PR also includes a few small refactorings. I introduced some duplication while adding this feature and didn't want to leave the code worse than I found it. Please advise if you think these refactorings (e8381d7 and b94a964/266a128) are out-of-scope for the PR and should be removed.
Any other suggestions you may have for improvement are welcome!