提交 5223b394 编写于 作者: EvanOne(文一)'s avatar EvanOne(文一)

docs: Update docs

chore: Modify loading svg
上级 9e6ba147
......@@ -36,7 +36,7 @@ favicon:
# msapplication: /images/icons/favicon-144x144.png
# PWA
# See: https://github.com/JLHwung/hexo-offline/
# See: https://github.com/lavas-project/hexo-pwa/
pwa:
enable: false
manifest: /manifest.json
......
......@@ -2,36 +2,56 @@
## PWA <Badge text="Stable"/> <Badge text="v1.2.2"/>
想要使用 PWA 特性,需要安装插件 [hexo-offline](https://github.com/JLHwung/hexo-offline),使用步骤如下:
如果你想要使网站支持 PWA 特性,需要安装插件 [hexo-pwa](https://github.com/lavas-project/hexo-pwa),该插件可以使你的网站具有以下功能:
- [Web App Manifest](https://developer.mozilla.org/en-US/docs/Web/Manifest) - 用户可以将您的站点添加到移动主屏幕
- [Service Worker](https://developers.google.com/web/fundamentals/primers/service-workers/) - 让您的网站离线可用
使用步骤如下:
1、安装插件
```bash
$ npm install hexo-offline --save
$ npm install --save hexo-pwa
```
2、配置插件
找到 Hexo 根目录下的 _config.yml 文件,添加以下字段:
找到 Hexo 根目录下的 `_config.yml` 文件,添加以下字段:
``` yaml
offline:
# 缓存的最大文件大小,以字节为单位
maximumFileSizeToCacheInBytes: 5242880
# 静态文件,如果你的站点使用了例如 webp 格式的文件,请将文件类型添加进去
staticFileGlobs:
- public/**/*.{js,html,css,png,jpg,gif,svg,eot,ttf,woff,woff2}
stripPrefix: public
verbose: true
# 缓存 CDN 资源(如果你不需要,则不用配置该项)
runtimeCaching:
- urlPattern: /*
handler: cacheFirst
options:
origin: # 替换成你 CDN 的域名
```
有关插件的详尽信息,请查看插件的[文档](https://github.com/JLHwung/hexo-offline)
pwa:
manifest:
# Manifest 文件名和路径
path: /manifest.json
serviceWorker:
# Service Worker 的文件名和路径
path: /sw.js
# 在 / 路径(首页)下,预加载的文章数
preload:
urls:
- /
posts: 5
# 具体请查看:https://googlechromelabs.github.io/sw-toolbox/api.html#options
opts:
# 网络请求超时自动返回到缓存过的响应的时间
networkTimeoutSeconds: 5
routes:
# 缓存你的静态资源,例如你使用了 webp 格式的图片,将其添加进去
- pattern: !!js/regexp /.*\.(js|css|html|jpg|jpeg|png|svg|gif|json|xml|eot|ttf|woff|woff2)$/
# 缓存策略,可选值:cacheFirst, networkFirst, cacheOnly, networkOnly, fastest
# 每个值的具体含义请查看:https://googlechromelabs.github.io/sw-toolbox/api.html#handlers
strategy: cacheFirst
- pattern: !!js/regexp /\//
strategy: networkFirst
# 如果你想缓存 CDN 资源,请像下面这样进行设置
- pattern: !!js/regexp /cdn.jsdelivr.net/
strategy: cacheFirst
# Hexo 插件的优先级,默认为 10
priority: 5
```
有关插件的详尽信息,请查看插件的[文档](https://github.com/lavas-project/hexo-pwa)
3、修改主题配置
......
<svg xmlns="http://www.w3.org/2000/svg" class="lds-spinner" preserveAspectRatio="xMidYMid" style="background:0 0" viewBox="0 0 100 100"><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2"><animate attributeName="opacity" begin="-0.9230769230769231s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(27.692 50 50)"><animate attributeName="opacity" begin="-0.8461538461538461s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(55.385 50 50)"><animate attributeName="opacity" begin="-0.7692307692307693s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(83.077 50 50)"><animate attributeName="opacity" begin="-0.6923076923076923s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(110.77 50 50)"><animate attributeName="opacity" begin="-0.6153846153846154s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(138.462 50 50)"><animate attributeName="opacity" begin="-0.5384615384615384s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(166.154 50 50)"><animate attributeName="opacity" begin="-0.46153846153846156s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(193.846 50 50)"><animate attributeName="opacity" begin="-0.38461538461538464s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(221.538 50 50)"><animate attributeName="opacity" begin="-0.3076923076923077s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(249.23 50 50)"><animate attributeName="opacity" begin="-0.23076923076923078s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(276.923 50 50)"><animate attributeName="opacity" begin="-0.15384615384615385s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(304.615 50 50)"><animate attributeName="opacity" begin="-0.07692307692307693s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(332.308 50 50)"><animate attributeName="opacity" begin="0s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid" viewBox="0 0 100 100" width="50" height="50"><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2"><animate attributeName="opacity" begin="-0.9230769230769231s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(27.692 50 50)"><animate attributeName="opacity" begin="-0.8461538461538461s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(55.385 50 50)"><animate attributeName="opacity" begin="-0.7692307692307693s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(83.077 50 50)"><animate attributeName="opacity" begin="-0.6923076923076923s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(110.77 50 50)"><animate attributeName="opacity" begin="-0.6153846153846154s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(138.462 50 50)"><animate attributeName="opacity" begin="-0.5384615384615384s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(166.154 50 50)"><animate attributeName="opacity" begin="-0.46153846153846156s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(193.846 50 50)"><animate attributeName="opacity" begin="-0.38461538461538464s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(221.538 50 50)"><animate attributeName="opacity" begin="-0.3076923076923077s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(249.23 50 50)"><animate attributeName="opacity" begin="-0.23076923076923078s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(276.923 50 50)"><animate attributeName="opacity" begin="-0.15384615384615385s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(304.615 50 50)"><animate attributeName="opacity" begin="-0.07692307692307693s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect><rect width="7" height="16" x="46.5" y="9" fill="#888" rx="37.2" ry="7.2" transform="rotate(332.308 50 50)"><animate attributeName="opacity" begin="0s" dur="1s" keyTimes="0;1" repeatCount="indefinite" values="1;0"/></rect></svg>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册