From 0e1579bab0e6ffd09ce6ff54f8ad864d735ea318 Mon Sep 17 00:00:00 2001 From: zkz098 Date: Sat, 2 Nov 2024 14:58:38 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20CSS=E6=9E=B6=E6=9E=84=E6=8B=86?= =?UTF-8?q?=E5=88=86=20[publish=20dev]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 32 ++++++++++++++++---------------- layout/_partials/head/head.pug | 2 -- layout/_partials/layout.pug | 1 + layout/archive.pug | 3 +++ layout/category.pug | 3 +++ layout/index.pug | 3 +++ layout/page.pug | 3 +++ layout/post.pug | 4 ++++ layout/tag.pug | 3 +++ package.json | 1 - source/css/app.styl | 13 ------------- source/css/page.styl | 3 +++ source/css/post.styl | 5 +++++ source/css/scaffolding.styl | 5 +++++ 14 files changed, 49 insertions(+), 32 deletions(-) create mode 100644 source/css/page.styl create mode 100644 source/css/post.styl create mode 100644 source/css/scaffolding.styl diff --git a/README.md b/README.md index 5c78878..c223308 100644 --- a/README.md +++ b/README.md @@ -2,22 +2,22 @@ 此分支为 ShokaX 0.5 实验性变更分支,确保0.5开发期间0.4的维护不受影响 计划更改: -- 移除 pjax -- 移除 quicklink -- 移除 assetUrl 为基的动态 Vendor 机制 -- 移除 ShokaX Inject -- 引入新的 Inject 类技术 (长期) -- 引入新的工作流程 -- 引入 CI 自动测试 -- 重构 player (暂时移除) -- 优化 menu 配置格式 -- 优化和异步化 Smart Bundle 技术 -- 优化 CSS 结构和加载 -- 修复/重置 fancybox -- 修复模板长期遗留问题 -- 修复 images 遗留问题 -- 规范化配置文件 -- 规范化文档 +- [x] 移除 pjax +- [x] 移除 quicklink +- [x] 移除 assetUrl 为基的动态 Vendor 机制 +- [ ] 移除 ShokaX Inject +- [ ] 引入新的 Inject 类技术 (长期) +- [ ] 引入新的工作流程 +- [ ] 引入 CI 自动测试 +- [ ] 重构 player (暂时移除) +- [ ] 优化 menu 配置格式 +- [ ] 优化和异步化 Smart Bundle 技术 +- [ ] 优化 CSS 结构和加载 +- [x] 修复/重置 fancybox +- [ ] 修复模板长期遗留问题 +- [ ] 修复 images 遗留问题 +- [ ] 规范化配置文件 +- [ ] 规范化文档 ## 📚子项目 - [ShokaX docs](https://github.com/theme-shoka-x/shokaX-docs) ShokaX 主题文档 (正在编写中,欢迎加入!) diff --git a/layout/_partials/head/head.pug b/layout/_partials/head/head.pug index ba664c8..6ea3569 100644 --- a/layout/_partials/head/head.pug +++ b/layout/_partials/head/head.pug @@ -41,7 +41,6 @@ each dnsLink in dnslinks - var fontConfig = theme.font?.loadFromGoogle if fontConfig != _vendor_font() -!= _css('app.css') != preloadjs() != load_async_css() @@ -50,7 +49,6 @@ link(rel="stylesheet" media="none" onload="this.media='all'" href="https://s4.zs link(rel="stylesheet" media="none" onload="this.media='all'" href="https://s4.zstatic.net/ajax/libs/justifiedGallery/3.8.1/css/justifiedGallery.min.css") link(rel="stylesheet" media="none" onload="this.media='all'" href="https://s4.zstatic.net/ajax/libs/KaTeX/0.16.9/katex.min.css") //link(rel="stylesheet" media="none" onload="this.media='all'" href="https://s4.zstatic.net/ajax/libs/KaTeX/0.16.9/katex.min.css") -!= _css('mermaid.css') if theme.experiments.cloudflarePatch != _js('cf-patch.js') diff --git a/layout/_partials/layout.pug b/layout/_partials/layout.pug index f9d6e7f..5cbbdc5 100644 --- a/layout/_partials/layout.pug +++ b/layout/_partials/layout.pug @@ -20,6 +20,7 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f != partial('_partials/head/head_com.pug') != shokax_inject('head') + block head title block title != `${alternate?alternate + " = ":""}${title}${subtitle?" = "+subtitle:""}` diff --git a/layout/archive.pug b/layout/archive.pug index de1053c..288d16c 100644 --- a/layout/archive.pug +++ b/layout/archive.pug @@ -1,5 +1,8 @@ extends _partials/layout.pug +block head + != _css('page.css') + block title if is_month() != `${page.year}${__('symbol.year')}/${page.month}${__('symbol.month')}` diff --git a/layout/category.pug b/layout/category.pug index c1f7fd4..cdc8b6a 100644 --- a/layout/category.pug +++ b/layout/category.pug @@ -1,5 +1,8 @@ extends ./_partials/layout.pug +block head + != _css('page.css') + block title != `${__('title.category')}${__('symbol.colon')}${page.category}` diff --git a/layout/index.pug b/layout/index.pug index 2eced5b..dfc3e51 100644 --- a/layout/index.pug +++ b/layout/index.pug @@ -3,6 +3,9 @@ include _mixin/card.pug include _mixin/postmeta.pug include _mixin/segment.pug +block head + != _css('page.css') + block content div(class="index wrap") if page.current === 1 diff --git a/layout/page.pug b/layout/page.pug index c35d2ca..9486626 100644 --- a/layout/page.pug +++ b/layout/page.pug @@ -2,6 +2,9 @@ extends _partials/layout.pug include _mixin/sidebar.pug include _mixin/comment.pug +block head + != _css('post.css') + block title if page.type === 'categories' != __('title.all') + __('title.category') diff --git a/layout/post.pug b/layout/post.pug index 61e9ad7..07dbe9e 100644 --- a/layout/post.pug +++ b/layout/post.pug @@ -3,6 +3,10 @@ include _mixin/sidebar.pug include _mixin/comment.pug include _mixin/postmeta.pug +block head + != _css('post.css') + != _css('mermaid.css') + block title - var page_title = page.title if page.categories && page.categories.length diff --git a/layout/tag.pug b/layout/tag.pug index 2b1e80d..6537bc1 100644 --- a/layout/tag.pug +++ b/layout/tag.pug @@ -1,5 +1,8 @@ extends ./_partials/layout.pug +block head + != _css('page.css') + block title != `${__('title.tag')}${__('symbol.colon')}${page.tag}` diff --git a/package.json b/package.json index 4e84e5d..18a09e8 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,6 @@ "@types/js-yaml": "^4.0.9", "@types/katex": "^0.16.7", "@types/node": "^22.8.6", - "@types/quicklink": "^2.3.4", "@typescript-eslint/eslint-plugin": "^8.12.2", "@typescript-eslint/parser": "^8.12.2", "eslint": "^9.13.0", diff --git a/source/css/app.styl b/source/css/app.styl index 3444a91..dd526b1 100644 --- a/source/css/app.styl +++ b/source/css/app.styl @@ -20,22 +20,9 @@ if $_iconfont = hexo-config('style.iconfont') else @import "_iconfont"; -// Scaffolding -@import "_common/scaffolding"; - -// Layout -@import "_common/outline"; - -// Components -@import "_common/components"; - if $custom = hexo-config('style.custom') @import $custom; -if hexo-config('injects.style') - for $inject_style in hexo-config('injects.style') - @import $inject_style; - if $optimize = hexo-config('experiments.optimizeLongPosts') @import "optimize.styl" diff --git a/source/css/page.styl b/source/css/page.styl new file mode 100644 index 0000000..8660272 --- /dev/null +++ b/source/css/page.styl @@ -0,0 +1,3 @@ +@import "scaffolding" + +@import "_common/components/pages" \ No newline at end of file diff --git a/source/css/post.styl b/source/css/post.styl new file mode 100644 index 0000000..97ed2b4 --- /dev/null +++ b/source/css/post.styl @@ -0,0 +1,5 @@ +@import "scaffolding" + +@import "_common/components/post" +@import "_common/components/highlight" +@import "_common/components/tags" \ No newline at end of file diff --git a/source/css/scaffolding.styl b/source/css/scaffolding.styl new file mode 100644 index 0000000..cee0db8 --- /dev/null +++ b/source/css/scaffolding.styl @@ -0,0 +1,5 @@ +@import "app" + +@import "_common/scaffolding" +@import "_common/outline" +@import "_common/components/third-party" \ No newline at end of file