2createStudio / postcss-sprites

Generate sprites from stylesheets.
MIT License
413 stars 50 forks source link

Add currently processed file to groupBy callback arguments #58

Closed niksy closed 8 years ago

niksy commented 8 years ago

Currenty, only image object is argument for groupBy callback, but having access to additional properties such as currently processed file and it’s name is useful for situations where you would like to group sprites based on CSS filename or if one file uses same icon from other file and your grouping method allows them to override already existing file.

To make it consistent, adding same rule for filterBy would also be nice.

vvasilev- commented 8 years ago

@niksy, Thanks for the PR. I think it's better to add the filename of stylesheet as a property to Image object. The reason for this is to have fewer arguments that are passed to filterBy & groupBy functions. What's your opinion about this?

niksy commented 8 years ago

That could work! Something along the lines originatingFile? Do you want me to update the PR or would you like to deal with this?

niksy commented 8 years ago

OK, I’ve updated the PR, it seems like we already have declaration for that, styleFilePath, so I’ve used that for object property and value.