Pass Vinyl file object to the function 'to(iconFile)' in a new major version #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, this plugin is great. After sprity/sprity is no longer maintained, gulp.spritesmith-multi keeps our work going. Thank you!
Summary
to(iconFile)
in version 4.0.0.Changes about
to(iconFile)
For now, when
to(iconFile)
is a function, it will receive a Vinyl file object instead of a file path string. It allows users to obtain more useful information about the file (listed in Vinyl | gulp.js § Instance properties), such as parsing the relative path of a file based on the glob path passed togulp.src()
.Since the parameter passed to
to(iconFile)
has been changed, some old code related to it will be broken, so I marked it as a "breaking change". According to About semantic versioning | npm Docs § Incrementing semantic versions in published packages, when backward compatibility breaks, a new major version needs to be released.Why I change the plugin itself
I really know that the split sprites generation can be done by another way without modifying the plugin:
In the above code, I specified the path twice, because as far as I know, the glob path is difficult to compare with any ordinary path (without asterisk). After viewing the code from lib/tile.js#L18-L26 in sprity/sprity, I think using the APIs of Vinyl file object is a better way.