gulp-replace icon indicating copy to clipboard operation
gulp-replace copied to clipboard

Support async replacement

Open perrin4869 opened this issue 7 years ago • 5 comments

This could be useful when doing an async calculation of the replacement text (for example, compiling some javascript, etc). I could try to put together a PR this week :)

perrin4869 avatar Jun 17 '18 11:06 perrin4869

I am thinking to add a new async option, besides skipBinary. When true, the replacement function will return a promise. Since neither String.prototype.replace nor replacestream support a replacement function that resolves, the logic for the async case would be separate from the sync one... basically converting the vinyl file's contents to a string, and then executing the replacement asynchronously.

perrin4869 avatar Jun 19 '18 15:06 perrin4869

The other option would be to export a separate, async version of the plugin

perrin4869 avatar Jun 19 '18 15:06 perrin4869

@perrin4869 did the async version release?

LvChengbin avatar Jun 06 '19 03:06 LvChengbin

@lazd any chance of getting this feature added, given that a PR doesn't seem to have ever been created?

mrweiner avatar Sep 14 '22 23:09 mrweiner

@mrweiner super low without a PR, I don't have incentive or time to add this feature myself.

lazd avatar Sep 15 '22 16:09 lazd