JSPM

rework-image-set

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

Rework CSS plugin to add future-proofed support for W3C-style image-set notation.

Package Exports

  • rework-image-set

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 (rework-image-set) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

rework-image-set Build Status js-standard-style

Rework plugin to add future-proofed support for W3C-style image set notation. This provides a backround-image fallback for browsers that don't support image-set.

Installation

npm install --save rework-image-set

Usage

var fs = require('fs')
var rework = require('rework')
var imageSet = require('rework-image-set')

var css = fs.readFileSync('css/my-file.css', 'utf8').toString()
var out = rework(css).use(imageSet()).toString()

Input

.bg-img {
  background-image: image-set('my-img.png' 1x,
                              'my-img-2x.png' 2x,
                              'my-img-print.png' 600dpi);
}

Output

.bg-img {
  background-image: url('my-img.png');
  background-image: image-set('my-img.png' 1x,
                              'my-img-2x.png' 2x,
                              'my-img-print.png' 600dpi);
}

Note: This functionality currently requires CSS prefixing, it's recommended to use autoprefixer.

License

MIT

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Crafted with <3 by John Otander (@4lpine).