Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vuepress-plugin-ipfs

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vuepress-plugin-ipfs - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "vuepress-plugin-ipfs",
"version": "1.0.0",
"version": "1.0.1",
"description": "Host a VuePress project on IPFS",

@@ -5,0 +5,0 @@ "main": "index.js",

# VuePress Plugin IPFS
> Convert a [VuePress](https://vuepress.vuejs.org/) 1.x bundle into relative paths making it suitable for hosting on IPFS.
## Usage
```
npm i -D vuepress-plugin-ipfs
```
### Setup
Add to `config.js` or `theme/index.js`
```
module.exports = {
plugins: [
['vuepress-plugin-ipfs'],
]
}
```
Once included this this plugin will post process all generated pages and CSS files to use relative asset paths during a production build.
## \$withBase - Base URL helper
Sites hosted on IPFS will be accessed via a variable depth so it is important to use relative paths for assets wherever possible, however there are certain scenarios where this is not viable due to components being included on multiple pages (such as headers/footers) or when asset paths are programmatically included.
If your site is accessed via an IPFS gateway the `base` path will be computed to include the current IPFS gateway and CID. For example, `https://gateway.ipfs.io/ipfs/<CID>/`, then `base` will be configured to `"/ipfs/<CID>/"`. The same goes for any IPNS gateway paths.
Therefore it is best to use this built in helper method to wrap asset paths. `$withBase` (injected onto Vue’s prototype) to generate the correct path when accessed via the root domain or IPFS gateway:
```vue
<img :src="$withBase('/foo.png')" alt="foo">
```
> Tip: You can use the above syntax in theme components and Markdown files.
**💡If you have a `base` key set in `.vuepress/config.js` or `theme/index.js` you will need to remove it in order for this plugin to work correctly.**
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc