urel
Get the relative URL between two root-relative URLs.
Setup
If you use a module bundler like Browserify, you can install urel
with npm
.
In your project root:
npm install urel --save
In one of your application modules:
var relative = ;
Examples
See the test.js
module for more details on what to expect. Here are a few examples.
; // './bar.html'; // '../bar.html'; // './dir/bar.html'
Note that this module currently only works with root-relative URLs (e.g. '/example/path.html'
) and not absolute URLs (e.g. 'http://example.com/example/path.html'
). If you'd like to see it work with absolute URLs, please submit a pull request.