Skip to content

Instantly share code, notes, and snippets.

@cwaring
Last active December 4, 2019 21:47
Show Gist options
  • Save cwaring/d27a3330ad0334b0e96475b9ff808fae to your computer and use it in GitHub Desktop.
Save cwaring/d27a3330ad0334b0e96475b9ff808fae to your computer and use it in GitHub Desktop.
Steps to make VuePress work on IPFS
  • 0: bake in a fake URL-token at build time using https://vuepress.vuejs.org/config/#base.
  • 1: post-build: regex out fake token in everything except JS.
  • 2: make the html/css paths relative. tip: https://github.com/olizilla/all-relative might be useful here.
  • 3: create a method to check if a site is loaded from an IPFS namespace and return the current hash or IPNS domain. tip: window.location.pathname.split('/')[1] || "/"
  • 4: replace all refs to the URL-token in JS to the new IPFS base path method created in 3.
  • 5: provided the plugins and router behave correctly this should now be IPFS aware.

Related open issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment