npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@agency-undone/nuxt-module-ipfs

v1.0.2-alpha.5

Published

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

Downloads

106

Readme

Nuxt Module for IPFS Gateway Routing

Overview

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

Enabling this plugin for Nuxt in static mode will allow resources, including pages, to be accessible via 3 different route structures:

  • foo.com/
  • gateway.ipfs.io/ipfs/Qma....AbFd/
  • ipfs.io/ipns/foo.com/

Subsequently, resources and other pages automatically use paths relative to those bases:

  • foo.com/bar.png
  • gateway.ipfs.io/ipfs/Qma....AbFd/bar.png
  • ipfs.io/ipns/foo.com/bar.png

or

  • foo.com/style.css
  • gateway.ipfs.io/ipfs/Qma....AbFd/style.css
  • ipfs.io/ipns/foo.com/style.css

Installation

npm package coming soon. Manual installation required for now.

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

nuxt.config.js

export default {
  target: 'static',
  modules: [
    '~/modules/nuxt-module-ipfs'
  ],
  router: {
    base: process.env.NODE_ENV === 'development' ? '/' : '/ipfs/hash/'
  }
}

Usage

Support for the assets directory potentially coming in the future

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:

component.vue

<template>
  <img :src="$relativity('/images/duck.jpg')" />
</template>

Additional Cases

To be added

Canonicalization and SEO

Additionally, it may be useful in the future to add a canonicalization option, to semantically declare one page as a duplicate of the other, and direct third party entities like bots to the correct resource. This would be accomplished by injecting a tag into <head> of the version that is considered secondary, which would look like

<link rel="canonical" href="foo.com/bar" />

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.

Roadmap

  • [ ] Add checker for target: static
  • [ ] Construct and inject rel="canonical" tag
  • [ ] Make the favicon path relative and working on all URL structures
  • [ ] Make 200.html path relative