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

gatsby-plugin-ipfs

Package Overview
Dependencies
Maintainers
20
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-plugin-ipfs

Adds support for deploying Gatsby to IPFS by ensuring that assets are relative

  • 2.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
20
decreased by-20%
Maintainers
20
Weekly downloads
 
Created
Source

gatsby-plugin-ipfs

NPM version Downloads Dependency status Dev Dependency status Greenkeeper badge

Adds support for deploying Gatsby websites to IPFS by ensuring that assets are relative.

Installation

$ npm install --save gatsby-plugin-ipfs

Usage

Set prefixPath to __GATSBY_IPFS_PATH_PREFIX__ and include the plugin in your gatsby-config.js file:

module.exports = {
    pathPrefix: '__GATSBY_IPFS_PATH_PREFIX__',
    plugins: [
        'gatsby-plugin-ipfs',
    ]
}

And now, simply build the project with npm run build -- --prefix-paths. Better yet, set it by default in your package.json:

"scripts": {
  "build": "gatsby build --prefix-paths"
},

But how?

It turns out the Gatsby doesn't support relative paths. But I didn't gave up and came up with smart and ugly hacks to do so:

  • Adds a post-build step that iterates over files and transforms every __GATSBY_IPFS_PATH_PREFIX__ occurrence
  • Adds a very small code snippet to every HTML page that defines the __GATSBY_IPFS_PATH_PREFIX__ global based on the browser location

License

MIT License

Keywords

FAQs

Package last updated on 06 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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