Support global and configuration-specific icon margin and padding #55
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.
The current SpriteSheetConfiguration.prototype.layoutImages implementation draws from an options property that is never set. Set it in the configuration constructor so that {h,v}{padding,margin} can be set in the config. Adding readme sections explaining usage.
To support configuration-specific margin and padding, we need to detect if it's necessary to re-print the entire sizing and background-positioning CSS for every media query block. In the base case (no configuration-specific spacing), the code detects that it's not needed to re-print the sizing declarations in the media query block, so there's no additional file size impact on the base case. In the special case, the full sizing declaration is re-printed in every media query block.
We could be smarter and only re-print if it's necessary (e.g., if there's only custom spacing for 3x pixel ratio but 2x has the same spacing as 1x).
This is related to the previous PR #54 but fixes the issue that was causing retina and non-retina output images to be different when hmargin, etc. were used.