node-spritesheet
node-spritesheet copied to clipboard
Support global and configuration-specific icon margin and padding
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.