auroral-ui / hexo-theme-aurora

🏳️‍🌈 Futuristic auroral Hexo theme.
https://blog.bennyxguo.com
MIT License
1.34k stars 214 forks source link

字体Rubik加载时间过长 #216

Open sunist-c opened 1 year ago

sunist-c commented 1 year ago

如下图所示

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 commented 1 year ago

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

sunist-c commented 1 year ago

目前的确是这么做的,但因为我是依赖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 commented 1 year ago

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

bennyxguo commented 1 year ago

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