css-absolutely
Pass in CSS from stylesheets or inline css tags and receive back CSS with all urls resolved to an absolute url.
Credits for the regex to parse css urls go to jrit's web-resource-inliner.
Rebuilding API documentation
npm run docs
This will append to README.md
by default.
Table of Contents
absoluteCss
Pass in CSS from stylesheets or inline css tags and receive back CSS with all urls resolved to an absolute url.
Parameters
css
string the css string to resolve to an absolute urlresolveTo
string the absolute url to resolve relative urls (urls without a protocol) to
Examples
const absCss = const input = `<div style="background-image: url('assets/icon.png');"></div>`const expected = `<div style="background-image: url('http://www.example.com/assets/icon.png');"></div>`const css = console // true
Returns string an example return type