Skip to content

Commit dee8924

Browse files
authored
Merge pull request #2 from agency-undone/develop
Feat: Major refactor
2 parents d7911a5 + 74edcaa commit dee8924

File tree

6 files changed

+159
-283
lines changed

6 files changed

+159
-283
lines changed

LICENSE

Lines changed: 0 additions & 201 deletions
This file was deleted.

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,28 @@
44

55
A Nuxt module that enables nuxt routing for both the intended path and IPFS gateway URLs, which include a CID (hash) of the asset.
66

7-
Enabling this plugin for Nuxt in **static mode** will allow resources, including pages, to be accessible via two routes. For example:
7+
Enabling this plugin for Nuxt in **static mode** will allow resources, including pages, to be accessible via 3 different route structures:
88

99
- `foo.com/`
1010
- `gateway.ipfs.io/ipfs/Qma....AbFd/`
11+
- `ipfs.io/ipns/foo.com/`
1112

12-
Subsequently, resources and other pages use paths relative to those bases:
13-
- `foo.com/bar`
14-
- `gateway.ipfs.io/ipfs/Qma....AbFd/bar`
13+
Subsequently, resources and other pages automatically use paths relative to those bases:
14+
- `foo.com/bar.png`
15+
- `gateway.ipfs.io/ipfs/Qma....AbFd/bar.png`
16+
- `ipfs.io/ipns/foo.com/bar.png`
1517

1618
or
1719
- `foo.com/style.css`
1820
- `gateway.ipfs.io/ipfs/Qma....AbFd/style.css`
21+
- `ipfs.io/ipns/foo.com/style.css`
1922

2023
## Installation
2124

2225
_`npm` package coming soon. Manual installation required for now._
2326

2427
1. Download this repo, extract it and put the resulting folder into your `modules` directory in your Nuxt project
25-
2. Add `target: 'static'` to your `nuxt.config.js`
28+
2. Add `target: 'static'` and `router.base` to your `nuxt.config.js`
2629
3. Add the module folder name to the `modules` array in `nuxt.config.js`
2730

2831
**nuxt.config.js**
@@ -31,24 +34,23 @@ export default {
3134
target: 'static',
3235
modules: [
3336
'~/modules/nuxt-module-ipfs'
34-
]
37+
],
38+
router: {
39+
base: process.env.NODE_ENV === 'development' ? '/' : '/ipfs/hash/'
40+
}
3541
}
3642
```
3743

3844
## Usage
3945

4046
_Support for the `assets` directory potentially coming in the future_
4147

42-
All image assets must be placed in the `static` directory, _not_ the `assets` directory.
43-
44-
All links and image assets must be wrapped using the included `$relativity()` global method.
48+
All image assets must be placed in the `static` directory, _not_ the `assets` directory and must be wrapped using the included `$relativity()` (including a starting forward slash) global method as outlined below:
4549

4650
**component.vue**
4751
```vue
4852
<template>
49-
<nuxt-link :to="$relativity('/duck')">
50-
<img :src="$relativity('/images/duck.jpg')" />
51-
</nuxt-link>
53+
<img :src="$relativity('/images/duck.jpg')" />
5254
</template>
5355
```
5456

@@ -65,9 +67,7 @@ Additionally, it may be useful in the future to add a canonicalization option, t
6567
Since IPFS gateway URLs were an older (and by some standards _legacy_) implementation, this tag would typically be added to the IPFS Gateway URLs only.
6668

6769
## Roadmap
68-
- [ ] Update hook to clear `WARN` message: `render:routeContext(nuxt) is deprecated, Please use vue-renderer:ssr:context(context)`
6970
- [ ] Add checker for `target: static`
70-
- [ ] Add checker for `publicPath` and `router.base` (values _must not_ be set in `nuxt.config.js`)
7171
- [ ] Construct and inject `rel="canonical"` tag
72-
- [ ] Make the favicon path relative
72+
- [ ] Make the favicon path relative and working on all URL structures
7373
- [ ] Make `200.html` path relative

0 commit comments

Comments
 (0)