klei/gulp-inject

Project statement in readme.md

Opened this issue · 3 comments

The readme.md states:

gulp-inject takes a stream of source files, transforms each file to a string and injects each transformed string into placeholders in the target stream files. See Basic usage and More examples below

I think this is a bit ambigous, because gulp-inject does not actually transform the contents of the source file. It transforms the file path into a string and injects it into placeholders in the target files. The actual source file is not transformed in any way.

Should this be rephrased, or am I just beeing overly critical?

You're right when it comes to the default settings, then the path of a file is transformed. But because a developer can write their own transform function with the only requirement that it should return a string, one can argue that the more general description is still suitable.
Or what do you think?

Is it possible to create a transform function that returns something other than a string, like an array or an object? If that is the case, then I would say the general description should be just "transforms each file".

Otherwise I would agree that the general description as it is now is better suited.

No, only strings (or undefined) are supported at the moment.
Good, closing this then! :)