Skip to content

About

Make any website installable and offline with one line: manifest, icons, service worker, offline page, install button and update toast. CLI plus a 4 kB runtime.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Skye, the installkite mascot: a kite shaped like an app icon with a tail of little download arrows

installkite

Make a website installable and offline capable with one command.

npm version CI status MIT license

Website · Check a site · Icon generator · Docs · Português

Run npx installkite init in your site folder. It writes the web app manifest, every icon size from one PNG or SVG, a service worker with an offline page, and the head tags for your HTML. Browsers can then install your site on a phone or a computer, with its own icon and window, and open it without a network. Visitors who just browse see the same site as before.

Quick start

npx installkite init --dry-run   # see a diff of every change first
npx installkite init             # answer a few questions, or add --yes
npx installkite doctor           # check what browsers look for

Deploy over HTTPS. After each later site build, refresh the list of cached files:

npx installkite build

It works on plain HTML folders and on Vite, Next.js (static export), Astro, WordPress and Laravel sites. The recipes cover each one.

What you get

File What it is
manifest.webmanifest Name, colors, start URL, display mode, icons and shortcuts
icons/, apple-touch-icon.png, favicon.ico Ten sizes, maskable icons with safe zone padding, the iPhone icon and favicons
sw.js A service worker that caches your pages with content hashes
offline.html A page in your colors for when there is no network
installkite.js A 4.4 kB script: install button, iPhone install steps, update toast and offline badge
installkite.config.json What init decided, so later runs ask nothing

The head tags go between <!-- installkite:start --> and <!-- installkite:end --> in every page. Running init again updates that block in place and keeps tags you already had.

Commands

npx installkite init        write everything and add the head tags
npx installkite build       refresh the cached file list after a site build (--check for CI)
npx installkite doctor      check the files on disk, or a live site with --url
npx installkite icons <img> only the icon set
npx installkite remove      take the installkite tags out of the HTML

Every option is in the CLI docs.

Your own install button

<script src="/installkite.js" data-sw="/sw.js" data-install="auto" defer></script>
<button data-installkite-install hidden>Install the app</button>

The button stays hidden until the browser can install the site. On iPhone and iPad it shows the Add to Home Screen steps instead. For more control:

installkite.on('installable', () => showMyButton());
const outcome = await installkite.install(); // 'accepted', 'dismissed', 'instructions' or 'unavailable'
installkite.on('update', ({ apply }) => showBanner('New version', apply));

See the runtime API and the Node API.

Limits

  • SVG logos are drawn by a small built in renderer. Text, masks, filters and patterns are skipped with a warning, so convert text to outlines first.
  • The CLI reads PNG and SVG. The online generator also reads JPEG and WebP.
  • iPhone and iPad have no install prompt, and desktop Firefox does not install sites. The offline page still works there.

Guides

More from kwy404

Monsoon, Voodoo.js, breakhound, vueleap, graphemely, numberparrot, edgegoat, cookieowl, a11ymedic, fontsketch and kastor.

Author

Made by Alexandre Kohler (GitHub, LinkedIn). The website is built with Monsoon, and its interactive parts with Voodoo.js.

License

MIT

About

Make any website installable and offline with one line: manifest, icons, service worker, offline page, install button and update toast. CLI plus a 4 kB runtime.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages