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

nextjs-webmanifest

v1.1.5

Published

Simplify adding webmanifest to your web.

Downloads

439

Readme

Next.js Webmanifest helper npm npm type definitions

Simplify adding webmanifest to your web.

Installation

npm install nextjs-webmanifest

Usage

With pages directory

Create app.webmanifest.js file inside your Next.js pages/api directory and use createWebmanifestHandler.

pages/api/app.webmanifest.js

import { createWebmanifestHandler } from 'nextjs-webmanifest'

export default createWebmanifestHandler({
	name: 'My Super Trouper App',
	short_name: 'App',
	start_url: '/',
	display: 'standalone',
	theme_color: '#04a600',
	background_color: '#000000',
	// You can add more: https://developer.mozilla.org/en-US/docs/Web/Manifest
})

Asynchronous

export default createWebmanifestHandler(async (request) => {
	const locale = request.url.substring(1, 3)
	const response = await fetch(`https://example.com/${locale}/manifest.json`)
	const manifest = await response.json()
	return manifest
})

<head>

Don't forget to add <link> to <head> to tell browser where to look for your webmanifest.

<link rel="manifest" href="/api/app.webmanifest" />

With app directory

Create route.js file inside your Next.js app/app.webmanifest directory and use createWebmanifestGET.

app/app.webmanifest/route.js

import { createWebmanifestGET } from 'nextjs-webmanifest'

export const GET = createWebmanifestGET({
	name: 'My Super Trouper App',
	// and more
})

createWebmanifestGET can accept asynchronous function as well.

<head>

Don't forget to add <link> to <head> to tell browser where to look for your webmanifest.

<link rel="manifest" href="/app.webmanifest" />

or

export const metadata: Metadata = {
	manifest: '/app.webmanifest',
}