Support async replacement
Opened this issue · 5 comments
perrin4869 commented
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 commented
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 commented
The other option would be to export a separate, async
version of the plugin
LvChengbin commented
@perrin4869 did the async version release?