How to supported retina @2x, @3x
See original GitHub issueIssue Description
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
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Retina Web Graphics Explained: 1x versus 2x (Low‑Res ...
Therefore it's best to create both 1x and 2x for desktops. Should You Make 3x Graphics? There are even higher resolution 3x displays,...
Read more >Optimizing Images for Retina Displays | SLEEPLESS MEDIA
How To Code 2x Graphics. The width should be set to half the width of the image file. For example, if the image...
Read more >How to cap image fidelity to 2x and save 45% image weight ...
So the first thing we started doing was to provide both a standard image and an image optimized for Retina displays, using the...
Read more >Retina image support (@1x @2x @3x) - Drupal Answers
Configure three normal image styles that produce the desired resolutions for each of the 1x, 2x, and 3x pixel densities.
Read more >A guide for creating a better retina web - Ivo Mynttinen
I recommend using the same file name for both, but adding “@2x” at the end for the retina assets (known from iOS development)....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Lkroner The
retina
option supports 3x images because of these lines. If something doesn’t work as you expected, you can useonUpdateRule
hook to implement the desired behavior. Here is an example - https://github.com/2createStudio/postcss-sprites/blob/master/examples/output-dimensions.md.Will this retina functionality support 3x images as well? Something like this. I don’t see anything in your documentation about it.