Closed zz5840 closed 6 years ago
I would be curious about the opinion of @crissdev on this, but I think it's a problem with Gulp, not with gulp-yaml
. Specifically if for any reason this plugin has incorrect input (including a wrong comma at end of a line), it should emit an error
event to the underlying stream.
Your problem seems to be that gulp.watch()
stops when any Gulp plugin emits an error
event. This problem was fixed in the latest version of Gulp (version 4), you should try to upgrade to it.
@zz5840 @ehmicky Sorry for the delay on this one.
https://github.com/crissdev/gulp-yaml/blob/7a7a372051bb44a289bd2f93462214c98a7a455f/index.js#L24
It seems getFileContents
returns null/undefined
if the parsed file has a syntax error. I cannot test this right now but maybe this might be the case.
Furthermore, I see the callback is called twice in case of an error (L63 && L27)
@zz5840 Could you edit node_modules\gulp-yaml\indexjs
in line 24, with the follwing snippet and see if it solves this problem?
const result = getFileContents(file, options, stream, callback)
if (result) file.contents = result
@crissdev it's affected, but when will you update and publish it to npm, or need i create a pr
@ehmicky oh thx, it's really helpful
if i add a comma to the end of a line, this plugin will throw a YAMLException which will break gulp watch. i tried to add gulp-plumber to prevent it, but it doesn't effect how could i solve it