@poi/plugin-pwa
Build a progressive web app with Poi and [Workbox](https://developers.google.com/web/tools/workbox/).
Last updated 2 years ago by egoist .
Original npm · Tarball · package.json
$ cnpm install @poi/plugin-pwa 
SYNC missed versions from official npm registry.

@poi/plugin-pwa

Build a progressive web app with Poi and Workbox.

Install

yarn add @poi/plugin-pwa --dev

How to use

In your poi.config.js:

module.exports = {
  plugins: [
    {
      resolve: '@poi/plugin-pwa',
      options: {}
    }
  ]
}

Then run Poi in production mode will generate a /service-worker.js file, you can register it in your app to make your website offline-ready.

You can manually register the service worker following the official guide, but there's also a module on npm which can be used to simplify the process:

yarn add register-service-worker
import { register } from 'register-service-worker'

register(process.env.PUBLIC_URL + 'service-worker.js', {
  ready(registration) {
    console.log('Service worker is active.')
  },
  registered(registration) {
    console.log('Service worker has been registered.')
  },
  cached(registration) {
    console.log('Content has been cached for offline use.')
  },
  updatefound(registration) {
    console.log('New content is downloading.')
  },
  updated(registration) {
    console.log('New content is available; please refresh.')
  },
  offline() {
    console.log('No internet connection found. App is running in offline mode.')
  },
  error(error) {
    console.error('Error during service worker registration:', error)
  }
})

Options

Default value:

{
  name: 'PWA app',
  themeColor: '#74d7fd', // The Poi color
  msTileColor: '#000000',
  appleMobileWebAppCapable: 'no',
  appleMobileWebAppStatusBarStyle: 'default',
  assetsVersion: '',
  iconPaths: {
    favicon16: 'img/icons/favicon-16x16.png',
    favicon32: 'img/icons/favicon-32x32.png',
    appleTouchIcon: 'img/icons/apple-touch-icon-152x152.png',
    safariMaskIcon: 'img/icons/safari-mask-icon.svg',
    msTileImage: 'img/icons/msapplication-icon-144x144.png'
  }
}

We use these options to generate manifest.json and update PWA-related tags in generated index.html file.

If you don't want to support some platform icons, simply pass false as the icon path, for example:

{
  iconPaths: {
    msTileImage: false
  }
}

Then we won't add HTML tag for this icon in index.html.

To customize the manifest.json, you can simply populate a public/manifest.json and we will merge it with our default one.

Current Tags

  • 12.0.4-canary.585.f015dbf.0                                ...           canary (a year ago)
  • 12.0.3                                ...           latest (2 years ago)
  • 12.0.0-beta.1                                ...           next (2 years ago)

30 Versions

  • 12.0.4-canary.585.f015dbf.0                                ...           a year ago
  • 12.0.3                                ...           2 years ago
  • 12.0.2                                ...           2 years ago
  • 12.0.1                                ...           2 years ago
  • 12.0.0                                ...           2 years ago
  • 12.0.0-beta.1                                ...           2 years ago
  • 12.0.0-beta.0                                ...           2 years ago
  • 12.0.0-alpha.7                                ...           2 years ago
  • 12.0.0-alpha.6                                ...           2 years ago
  • 11.0.0-beta.6                                ...           2 years ago
  • 11.0.0-beta.5                                ...           2 years ago
  • 11.0.0-beta.4                                ...           2 years ago
  • 11.0.0-beta.3                                ...           2 years ago
  • 11.0.0-beta.2                                ...           2 years ago
  • 11.0.0-beta.1                                ...           2 years ago
  • 11.0.0-beta.0                                ...           2 years ago
  • 11.0.0-alpha.22                                ...           2 years ago
  • 11.0.0-alpha.21                                ...           2 years ago
  • 11.0.0-alpha.20                                ...           2 years ago
  • 11.0.0-alpha.19                                ...           2 years ago
  • 11.0.0-alpha.18                                ...           2 years ago
  • 11.0.0-alpha.17                                ...           2 years ago
  • 11.0.0-alpha.16                                ...           2 years ago
  • 11.0.0-alpha.15                                ...           2 years ago
  • 11.0.0-alpha.13                                ...           2 years ago
  • 11.0.0-alpha.12                                ...           2 years ago
  • 11.0.0-alpha.11                                ...           2 years ago
  • 11.0.0-alpha.10                                ...           2 years ago
  • 11.0.0-alpha.9                                ...           2 years ago
  • 11.0.0-alpha.8                                ...           2 years ago
Downloads
Today 0
This Week 2
This Month 5
Last Day 0
Last Week 1
Last Month 2
Dependencies (3)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |