Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

字体Rubik加载时间过长 #216

Open
sunist-c opened this issue Sep 4, 2022 · 4 comments
Open

字体Rubik加载时间过长 #216

sunist-c opened this issue Sep 4, 2022 · 4 comments

Comments

@sunist-c
Copy link

sunist-c commented Sep 4, 2022

如下图所示

image

这一个字体加载了一分钟,无论我是在我在本地 hexo s,还是在海外服务器构建,均是如此。

在服务器上部署时,使用了docker,dockerfile如下:

FROM node:lts-alpine as builder

WORKDIR /app

ADD . .

RUN npm config set registry https://registry.npm.taobao.org && npm install hexo-cli -g && yarn add hexo-theme-aurora && yarn && hexo g

FROM nginx:alpine

COPY --from=builder /app/public/ /usr/share/nginx/html

EXPOSE 80
@Perfecto23
Copy link

翻墙把这个css和里面的字体下载下来放到自己服务器上,在node_modules里改一下代码就好了,

@sunist-c
Copy link
Author

sunist-c commented Sep 5, 2022

目前的确是这么做的,但因为我是依赖drone使用docker进行自动构建和部署的,每次都是新鲜获取的hexo-theme-aurora,这么搞就得用很阴间的方法强行inject进去:

# ...before

RUN rm node_modules/hexo-theme-aurora/data/en.yml node_modules/hexo-theme-aurora/data/cn.yml

RUN cp inject.yml node_modules/hexo-theme-aurora/data/en.yml && cp inject.yml node_modules/hexo-theme-aurora/data/cn.yml

RUN hexo clean && hexo generate

# ...after

@Perfecto23
Copy link

了解下patch-package,docker这样改有点麻烦了
image
image
image

@bennyxguo
Copy link
Member

可以找找还有没有 google 字体的中国镜像。或者我考虑后面把字体放到项目里面(本地化)。

@bennyxguo bennyxguo added change consider to improve in the future. performance labels Jul 19, 2023
@bennyxguo bennyxguo removed the change consider to improve in the future. label Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

3 participants