url() plugin for rework, formerly included in core
JavaScript
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test Add test for #5 Jul 31, 2015
.gitignore Initial commit Mar 14, 2014
.npmignore Initial commit Mar 14, 2014
.travis.yml Initial commit Mar 14, 2014
LICENSE Initial commit Mar 14, 2014
README.md Add npm instructions Jul 18, 2014
index.js Keep this object references to declaration Jul 26, 2015
package.json 1.1.0 Jul 31, 2015

README.md

rework-plugin-url

Build Status

Map url() calls. Replace all url()s using a given function.

Installation

$ npm install --save rework-plugin-url

Usage

var css = rework(read(css))
  .use(rework.url(function(url){
    return 'http://example.com' + url;
  }))
  .toString()
body {
  background: url(/images/bg.png);
}

yields:

body {
  background: url(http://example.com/images/bg.png);
}