1.0.3 • Published 7 years ago

absoluteify v1.0.3

Weekly downloads
7
License
MIT
Repository
github
Last release
7 years ago

absoluteify Build Status

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