Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/olizilla/all-relative
💫 convert a static site to use only relative urls
https://github.com/olizilla/all-relative
Last synced: 9 days ago
JSON representation
💫 convert a static site to use only relative urls
- Host: GitHub
- URL: https://github.com/olizilla/all-relative
- Owner: olizilla
- License: mit
- Created: 2019-10-11T17:25:33.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-12T15:32:05.000Z (almost 3 years ago)
- Last Synced: 2024-12-20T04:07:10.726Z (15 days ago)
- Language: JavaScript
- Homepage:
- Size: 426 KB
- Stars: 17
- Watchers: 3
- Forks: 4
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# all-relative
A command line tool to convert a static site to use only relative urls.
Run it from the the directory which contains your generated static site to have it convert all urls in html and css to be relative to that dir.
It leaves you with a portable website that doesn't care what path it is mounted at. `/`, `/olizilla/` `/ipfs/hash/`, `file://x/y/z/`, the lot, it don't care. This allows you to load the same static site via [IPFS](https://ipfs.io) or github pages, or the localfile system, as well as from the root of your custom domain. Relative urls are wonderful.
The command will **edit the files in place**, so it's best to run it on generated output that you can recreate if you need to. If you can't, be sure to take a back up of your site first.
✨🎷🐩
## Install
Install it with
```console
$ npm install -g all-relative
```or run just it wihtout installing it via `npx`
```console
$ npx all-relative
```## Usage
Run the command from the root directory of your static site.
```console
$ all-relative
```