lavas-project / hexo-pwa

Hexo PWA plugin
MIT License
133 stars 17 forks source link
hexo hexo-plugin pwa service-worker

hexo-pwa

NPM version NPM Downloads

Progressive Web Apps (PWA) plugin for Hexo.

hexo-pwa let Hexo sites have these two capabilities.

Installation

$ npm install --save hexo-pwa

Options

You can configure this plugin in _config.yml.

pwa:
  manifest:
    path: /manifest.json
    body:
      name: hexo
      short_name: hexo
      icons:
        - src: /images/android-chrome-192x192.png
          sizes: 192x192
          type: image/png
        - src: /images/android-chrome-512x512.png
          sizes: 512x512
          type: image/png
      start_url: /index.html
      theme_color: '#ffffff'
      background_color: '#ffffff'
      display: standalone
  serviceWorker:
    path: /sw.js
    preload:
      urls:
        - /
      posts: 5
    opts:
      networkTimeoutSeconds: 5
    routes:
      - pattern: !!js/regexp /hm.baidu.com/
        strategy: networkOnly
      - pattern: !!js/regexp /.*\.(js|css|jpg|jpeg|png|gif)$/
        strategy: cacheFirst
      - pattern: !!js/regexp /\//
        strategy: networkFirst
  priority: 5

License

MIT