rework-plugin-url

url() plugin for rework, formerly included in core

Usage no npm install needed!

<script type="module">
  import reworkPluginUrl from 'https://cdn.skypack.dev/rework-plugin-url';
</script>

README

rework-plugin-url

Build Status

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

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);
}