node package manager
We need your input. Help make JavaScript better: Take the 2017 JavaScript Ecosystem survey »

rework-image-set-plus

npm install --save rework-image-set-plus

Usage

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

Input

.bg-img {
  background-image: image-set(url('my-img.png') 4x);
}

Output

.bg-img {
  background-image: url('my-img@1x.png');
  background-image: image-set(url('my-img@1x.png') 1x,url('my-img@2x.png') 2x, url('my-img@3x.png') 3x, url('my-img.png') 4x);
}