Skip to content

Image *actually* doesn't fill sprite horizontally for repeat-x background #999

@kidkuro

Description

@kidkuro

Issue #362 reported that images were not stretching to horizontally fill the sprite when given a repeat of repeat-x in a sprite-map() invocation.

In that case, it turned out that the issue reporter had mistakenly used $new-repeat: repeat-x in the invocation instead of the name of the image, i.e. instead of the correct $my-bg-repeat: repeat-x, and there was actually nothing wrong.

The issue as it was described is now actually happening, even with the correct syntax.

We have been successfully using sprite-map() with repeat-x to generate sprites that correctly stretch the image horizontally to fill the sprite, much like as was achieved using vanilla spriting in this blog post, but after upgrading to 0.12.2 of Compass, the image is no longer stretching.

I have verified that it was working correctly in 0.11.7 and that it does not work in 0.12.1.

We have a folder called nav containing various images including a narrow image folder.png. The code we are using is:

$nav-sprite: sprite-map("nav/*.png", $folder-repeat: repeat-x);
.bar {
    background: sprite($nav-sprite, folder) repeat-x;
}

This worked perfectly in 0.11.x but in 0.12.x the generated sprite image does not stretch the folder.png image horizontally.

The vanilla spriting approach still works, so while we would prefer to use the sprite-map() helper, we can work around it using the following code:

$nav-folder-repeat: repeat-x !default;
@import "nav/*.png";
@include all-nav-sprites;
.bar {
    @include nav-sprite(folder);
    background-repeat: repeat-x;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions