html-prefixer

Prefix urls in

HTML Prefixer

Prefix URLs in <script>/<link>/<img> with a cdn URL

var inliner = require("js-inliner");
 
prefix(stream, { prefix : "//abcdefg123.cloudfront.net" }, function(errtext) {
    if(err) {
        throw new Error(err);
    }
    
    console.log(text.toString("utf8"));
});
  • stream {Stream} Readable stream to parse
  • options {Object}
  • cb {Function}
    • err {Error | null}
    • text {Buffer} Rewritten text
  • prefix {String} URL used to prefix elements.