Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Commit 08dd185

Browse files
authoredMay 7, 2017
Merge pull request #373 from SuperOl3g/master
Added: postcss-image-set-polyfill (#43)
2 parents 2ca6df0 + a1f8143 commit 08dd185

File tree

8 files changed

+55
-1
lines changed

8 files changed

+55
-1
lines changed
 

‎docs/content/features.md

+17
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,23 @@ a {
173173
|
174174
[Plugin documentation](https://github.com/jonathantneal/postcss-nesting)
175175

176+
## `image-set()` function
177+
178+
Allows you to set different images for each kind of resolution of user device.
179+
180+
```css
181+
.foo {
182+
background-image: image-set(url(img/test.png) 1x,
183+
url(img/test-2x.png) 2x,
184+
url(my-img-print.png) 600dpi);
185+
}
186+
```
187+
188+
[Specification](https://drafts.csswg.org/css-images-3/#image-set-notation)
189+
|
190+
[Plugin documentation](https://github.com/SuperOl3g/postcss-image-set-polyfill)
191+
192+
176193
## `color()` function
177194

178195
A color function to modify colors (transpiled to: `rgba()`)

‎docs/content/index.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ title: cssnext - Use tomorrow’s CSS syntax, today.
7373
<a href="/features/#nesting">nesting</a>
7474
</li>
7575
<li class="r-Grid-cell r-minS--1of2">
76-
<a href="/features/#color-function"><code>color()</code> function</a>
76+
<a href="/features/#image-set-function"><code>image-set()</code> function</a>
77+
</li>
78+
<li class="r-Grid-cell r-minS--1of2">
79+
<a href="/features/#color-function"><code>color()</code> function</a>
7780
</li>
7881
<li class="r-Grid-cell r-minS--1of2">
7982
<a href="/features/#hwb-function"><code>hwb()</code> function</a>

‎docs/content/playground.html

+9
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@
5050
@custom-selector :--heading h1, h2, h3, h4, h5, h6;
5151
:--heading { margin-top: 0 }
5252

53+
/* image-set function */
54+
.foo {
55+
background-image:
56+
image-set(
57+
url(img/test.png) 1x,
58+
url(img/test-2x.png) 2x
59+
);
60+
}
61+
5362
/* colors stuff */
5463
a {
5564
color: var(--highlightColor);

‎package.json

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"postcss-custom-selectors": "^3.0.0",
4444
"postcss-font-family-system-ui": "^1.0.1",
4545
"postcss-font-variant": "^2.0.0",
46+
"postcss-image-set-polyfill": "^0.3.3",
4647
"postcss-initial": "^1.3.1",
4748
"postcss-media-minmax": "^2.1.0",
4849
"postcss-nesting": "^2.0.5",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.image {
2+
background-image: image-set(
3+
url(img/test.png) 1x,
4+
url(img/test-2x.png) 2x,
5+
url(my-img-print.png) 600dpi
6+
);
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.image {
2+
background-image: url(img/test.png);
3+
}
4+
@media (min-resolution: 144dpi) {
5+
.image {
6+
background-image: url(img/test-2x.png);
7+
}
8+
}
9+
@media (min-resolution: 600dpi) {
10+
.image {
11+
background-image: url(my-img-print.png);
12+
}
13+
}

‎src/features-activation-map.js

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export default {
3333
// pseudoClassAnyLink: [ null ],
3434
colorRgba: [ "css3-colors" ],
3535
overflowWrap: [ "wordwrap" ],
36+
imageSet: [ "css-image-set" ],
3637
// will always be null since autoprefixer does the same game as we do
3738
// autoprefixer: [ null ]
3839
}

‎src/features.js

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ export default {
1515
// https://npmjs.com/package/postcss-calc
1616
calc: (options) => require("postcss-calc")(options),
1717

18+
// https://www.npmjs.com/package/postcss-image-set-polyfill
19+
imageSet: (options) => require("postcss-image-set-polyfill")(options),
20+
1821
// https://npmjs.com/package/postcss-nesting
1922
nesting: (options) => require("postcss-nesting")(options),
2023

0 commit comments

Comments
 (0)
This repository has been archived.