Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
大白技术控
yanglr2010
提交
5223b394
Y
yanglr2010
项目概览
大白技术控
/
yanglr2010
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
yanglr2010
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
5223b394
编写于
8月 09, 2019
作者:
EvanOne(文一)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
docs: Update docs
chore: Modify loading svg
上级
9e6ba147
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
42 addition
and
22 deletion
+42
-22
_config.yml
_config.yml
+1
-1
docs/zh-CN/advanced/third-part.md
docs/zh-CN/advanced/third-part.md
+40
-20
source/images/loading.svg
source/images/loading.svg
+1
-1
未找到文件。
_config.yml
浏览文件 @
5223b394
...
...
@@ -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
...
...
docs/zh-CN/advanced/third-part.md
浏览文件 @
5223b394
...
...
@@ -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、修改主题配置
...
...
source/images/loading.svg
浏览文件 @
5223b394
<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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录