SmartSprites

Duplicate fragments in sprite images

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 0.2.4
  • Component/s: None
  • Description:
    Hide

    Motivation

    Currently, if an image has more than one reference in the original CSS, SmartSprites will include it multiple times in the sprite image. Ideally, if one individual image is added many times to one sprite image, it should appear in it only once.

    Implementation

    Within each sprite image, there should be exactly one individual image per one sprite reference. Equal sprite references collected across different locations in a CSS file or different CSS files should point to the same sprite and individual image within the sprite. Sprite references should be considered equal if they refer to the same sprite (equal sprite-ref) and have equal bitmap renderings. In particular, equal bitmaps will be produced for equal sprite-alignment and sprite-margin-* properties, but when further sprite reference properties are added, the same rendering may be achieved by different sets of properties.

    Discussion

    The reason I've not stumbled upon this limitation in my previous SmartSprites-based designs is that I'd usually remove the duplication on the CSS code level, i.e. collapse many rules that used the same image like this:

    div#id1,
    div.logo,
    ul > li > div.x {
      background-image: url("../img/logo.png"); /** sprite-ref: sprite */
    }

    Until this duplicate removal is implemented, the above should work as a workaround.

    Show

    Motivation

    Currently, if an image has more than one reference in the original CSS, SmartSprites will include it multiple times in the sprite image. Ideally, if one individual image is added many times to one sprite image, it should appear in it only once.

    Implementation

    Within each sprite image, there should be exactly one individual image per one sprite reference. Equal sprite references collected across different locations in a CSS file or different CSS files should point to the same sprite and individual image within the sprite. Sprite references should be considered equal if they refer to the same sprite (equal sprite-ref) and have equal bitmap renderings. In particular, equal bitmaps will be produced for equal sprite-alignment and sprite-margin-* properties, but when further sprite reference properties are added, the same rendering may be achieved by different sets of properties.

    Discussion

    The reason I've not stumbled upon this limitation in my previous SmartSprites-based designs is that I'd usually remove the duplication on the CSS code level, i.e. collapse many rules that used the same image like this:
    div#id1,
    div.logo,
    ul > li > div.x {
      background-image: url("../img/logo.png"); /** sprite-ref: sprite */
    }
    Until this duplicate removal is implemented, the above should work as a workaround.
  1. smartsprites.zip
    (3.59 MB)
    Kanu Dialani
    03/Sep/09 11:00 PM

Activity

People

Dates

  • Created:
    18/Jul/08 09:06 AM
    Updated:
    16/Feb/10 06:26 PM
    Resolved:
    16/Feb/10 06:26 PM

Time Tracking

Estimated:
6h
Original Estimate - 6h Original Estimate - 6h
Remaining:
0h
Remaining Estimate - 0h
Logged:
6h 5m
Time Spent - 6h 5m