Candinya / Kratos-Rebirth

一个可爱而现代的 Hexo 主题
GNU General Public License v3.0
630 stars 80 forks source link

从dark css中删除light style,并按需加载 #113

Closed ArcticLampyrid closed 2 years ago

ArcticLampyrid commented 2 years ago

在目前主题的设计方案中,暗色主题虽然使用单独css,但该css中还包含了一份light的样式。而且在main css中也同样包含了一份light style。 由于需要支持关闭暗色模式的配置项等原因,似乎在main css中包含light style不可避免,也不方便将dark style合并入main css。 那么在dark css中删去light css的配置,并且按需加载dark css以提高性能(在大多数情况,尤其是无缓存的首次加载,往往用不到暗色模式)似乎是一个较好的方案 同时,这样可以避免CSS变量,以提高潜在的兼容性

注: 本PR将dark.js改成了blocking式的加载,理由是为了避免开启暗色模式后先加载light theme,几秒钟后再切换到dark theme的闪烁问题。

Candinya commented 2 years ago

非常感激!

ArcticLampyrid commented 2 years ago

测试的时候记得清一次缓存