lazd/gulp-replace

Support async replacement

Opened this issue · 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 :)

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.

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

@perrin4869 did the async version release?

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

lazd commented

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