https://github.com/tmcw/make-relative
https://github.com/tmcw/make-relative
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/tmcw/make-relative
- Owner: tmcw
- License: other
- Created: 2019-05-19T17:48:08.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-03T10:07:30.000Z (over 3 years ago)
- Last Synced: 2025-03-16T01:55:50.109Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 48.8 KB
- Stars: 29
- Watchers: 2
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# make-relative
A missing link for IPFS compatibility: this module makes links relative on
a website, so that one can navigate through the pages when using IPFS. IPFS
essentially makes websites run in sub-directories, so if you’re using links
that start with /, then they’ll jump to the wrong place.
Installation:
```
npm install -g https://github.com/tmcw/make-relative
```
Usage:
This needs to be run in the root of a built website. It will find all HTML
files under its current path and rewrite the following references in-place:
- a href, link href
- meta content
- img src
```sh
$ make-relative https://expected-domain-name.com
```
The domain name is required, because that makes this able to make domain-absolute links relative if they point to the same website.