absoluteify
v1.0.3
Published
Streamingly transform relative HTML paths to absolute urls
Downloads
10
Maintainers
Readme
absoluteify
Streamingly transform relative HTML paths to absolute urls
Install
$ npm install --save absoluteify
Usage
var absoluteify = require('absoluteify')
var fs = require('fs')
fs.createReadStream('file.html')
.pipe(absoluteify('https://github.com'))
.pipe(process.stdout)
Input
<script src="app.js"></script>
<link href="styles.css">
<img src="photo.jpg">
Output
<script src="https://github.com/app.js"></script>
<link href="https://github.com/styles.css">
<img src="https://github.com/photo.jpg">
API
absoluteify(base)
-> TransformStream
Returns a transform stream that uses trumpet to absolute-ify <script>
, <link>
, and <img>
tags.
base
Required
Type: string
The base URL to prefix before the relative attribute URLs.
License
MIT © Ben Drucker