Skip to content

How to supported retina @2x, @3x #86

@yutucc

Description

@yutucc

Hello, I want to realize function, like this:

In /src/images/slice/ have two pic: test.png and test@2x.png

Css In

.icon-test {
    width: 32px;
    height: 32px;
    background-image: url(../slice/test.png);
}

Css Out

.icon-test {
    background-image: url(../sprite/style-index.png);
}

// Retina 2x supported
@media only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min--moz-device-pixel-ratio: 2),
only screen and (-webkit-min-device-pixel-ratio: 2.5),
only screen and (min-resolution: 240dpi) {
.icon-test { 
    background-image:url("../sprite/style-index@2x.png");
    background-position: -36px -66px;
    background-size: 32px;
}
}

reference: gulp-tmtsprite

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