Pass Vinyl file object to the function 'to(iconFile)' in a new major version#10
Open
pzhlkj6612 wants to merge 4 commits intoreducejs:masterfrom
Open
Pass Vinyl file object to the function 'to(iconFile)' in a new major version#10pzhlkj6612 wants to merge 4 commits intoreducejs:masterfrom
pzhlkj6612 wants to merge 4 commits intoreducejs:masterfrom
Conversation
The options function doesn't receive `options.to`, but receives 2 extra parameters. I've also added a sass example in there.
BREAKING CHANGE! In order to support more functions, such as generating split sprites [1] , we need to get Vinyl file object to obtain more useful information in the function 'to(iconFile)'. Since the parameter passed to 'to(iconFile)' has been changed, some old code related to it will be broken, so a new major version is also needed. [1] Similar funtion to the 'split' option in https://github.com/sprity/sprity#how-to-use-split-option
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.