JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 165127
  • Score
    100M100P100Q171962F
  • License MIT

PostCSS plugin for fallback image-set

Package Exports

  • postcss-image-set-polyfill

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (postcss-image-set-polyfill) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

postcss-image-set-polyfill Build Status npm version

PostCSS plugin for fallback image-set property.

/* Input example */
.foo {
    background-image: image-set(url(img/test.png) 1x,
                                url(img/test-2x.png) 2x,
                                url(my-img-print.png) 600dpi);
}
/* Output example */
.foo {
    background-image: url(img/test.png);
}

@media (min-resolution: 144dpi) {
    .foo {
        background-image: url(img/test-2x.png);
    }
}

@media (min-resolution: 600pdi) {
    .foo{
        background-image: url(my-img-print.png);
    }
}

Installation

npm i postcss-image-set-polyfill -D

Usage

var postcssImageSet = require('postcss-image-set-polyfill');

postcss([postcssImageSet]).process(YOUR_CSS, /* options */);;

See PostCSS docs for examples for your environment.

###⚠️️ Warning

If you use autoprefixer, place this plugin before it to prevent styles duplication.