• Stars
    star
    131
  • Rank 275,867 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 7 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Hexo PWA plugin

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
  • manifest - manifest configuration
    • path - the path of manifest.json, eg: /manifest.json
    • body - the content of manifest.json, manifest.json example. body can be null, if not null, hexo-pwa will generate manifest.json with JSON.stringify(body)
  • serviceWorker - service worker configuration
    • path: the path of sw.js, eg: /sw.js, you shouldn't put sw.js in subdirectory because of the service worker scope
    • preload - urls or posts that you want to preload
      • urls: an array of the preload urls
      • posts: the count of preload posts
    • opts: the options for sw-toolbox
    • routes - request routes and strategies, based on sw-toolbox. The routes order does matter.
      • pattern: url pattern, this config can be express-style or RegExp
      • strategy: the strategy you want to choose. All strategies: cacheFirst, networkFirst, cacheOnly, networkOnly, fastest. Caution: Log requests should use networkOnly strategy.
  • priority - plugin priority (default value is 10)

License

MIT

More Repositories

1

lavas

基于 Vue 的 PWA 解决方案,帮助开发者快速搭建 PWA 应用,解决接入 PWA 的各种问题
JavaScript
1,964
star
2

vue-skeleton-webpack-plugin

Lavas webpack plugin: skeleton solution for PWA webshell
JavaScript
886
star
3

pwa-book

这是一本 PWA 相关的书籍
JavaScript
164
star
4

jekyll-pwa

Jekyll plugin for PWA
Ruby
101
star
5

pwa-doc

Lavas PWA documents
93
star
6

lavas-tutorial

Lavas 指导教程文档
67
star
7

pwa-book-demo

JavaScript
48
star
8

lavas-template-vue-appshell

Lavas Template with App Shell
JavaScript
45
star
9

sw-register-webpack-plugin

Lavas webpack plugin: service worker register for sw.js file no-cache solution
JavaScript
37
star
10

lavas-template-vue-mpa

Lavas Template with Multiple Page App
JavaScript
36
star
11

lavas-project.github.io

Lavas website
JavaScript
26
star
12

lavas-template-vue

Lavas Vue 模板,包括 Basic 和 AppShell
JavaScript
22
star
13

lavas-demo-blog

(Deprecated) Lavas pwa blog demo
JavaScript
19
star
14

lavas-template-vue-ssr

Lavas Template with Server Side Rendering
JavaScript
18
star
15

lavas-demo-news

Lavas webapp demo for news
JavaScript
18
star
16

pwa-lesson-demo

Demos for PWA lessons
JavaScript
18
star
17

vue-style-variables-loader

Webpack loader for loading global variable.less/styl/sass files in every vue component
JavaScript
15
star
18

lavas-template-vue-basic

Lavas Basic Template
JavaScript
9
star
19

pwa-expo

PWA 相关特性支持度说明,关注国内主流浏览器。 Updating...
9
star
20

crater

为大型WEB站点自动生成service worker,支持下属模块互不影响地缓存静态资源
JavaScript
8
star
21

kram

基于 marked、highlight.js 的文档编译系统
JavaScript
6
star
22

lavas-scaffold

Lavas 创建 PWA 工程脚手架模块
JavaScript
5
star
23

codelab

Codelabs of Lavas
4
star
24

pwa-features-autotest

Support PWA features automated testing on multi-browsers
JavaScript
2
star
25

lavas-core

JavaScript
1
star