feat: theme.css 输出到仓库根目录,截图调整为社区规范尺寸

为 Obsidian 社区主题提交做准备:
- Vite 构建同时输出 theme.css 到根目录
- 同步脚本、审计脚本、Release CI 统一引用根目录路径
- 截图调整为 512×288(社区列表规范尺寸)
This commit is contained in:
Darkings 2026-05-09 15:09:01 +08:00
parent f8f56ae8a9
commit 16a65543f1
6 changed files with 144 additions and 4 deletions

View file

@ -27,7 +27,7 @@ jobs:
uses: softprops/action-gh-release@v2
with:
files: |
dist/theme.css
theme.css
manifest.json
fail_on_unmatched_files: true
generate_release_notes: true

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 214 KiB

View file

@ -1,7 +1,7 @@
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
const themeCssPath = resolve(import.meta.dirname, "../dist/theme.css");
const themeCssPath = resolve(import.meta.dirname, "../theme.css");
const themeCss = readFileSync(themeCssPath, "utf8");
const urlMatches = [...themeCss.matchAll(/url\((["']?)(.*?)\1\)/gi)].map((match) => match[2]);

View file

@ -14,7 +14,7 @@ const vaultThemeDir = resolve(vaultRoot, ".obsidian/themes/Monokai Syntax");
mkdirSync(vaultThemeDir, { recursive: true });
copyFileSync(resolve(rootDir, "dist/theme.css"), resolve(vaultThemeDir, "theme.css"));
copyFileSync(resolve(rootDir, "theme.css"), resolve(vaultThemeDir, "theme.css"));
copyFileSync(resolve(rootDir, "manifest.json"), resolve(vaultThemeDir, "manifest.json"));
console.log(`已同步主题到:${vaultThemeDir}`);

137
theme.css Normal file

File diff suppressed because one or more lines are too long

View file

@ -5,6 +5,7 @@ import { defineConfig } from "vite";
const rootDir = import.meta.dirname;
const outDir = resolve(rootDir, "dist");
const themeCssPath = resolve(outDir, "theme.css");
const rootThemeCssPath = resolve(rootDir, "theme.css");
const licensePath = resolve(rootDir, "src/css/license.css");
const styleSettingsDir = resolve(rootDir, "src/css/style-settings");
@ -30,8 +31,10 @@ function obsidianThemeBundle() {
.trim();
const styleSettings = readStyleSettings();
const sections = [license, themeCss, styleSettings].filter(Boolean);
const bundled = `${sections.join("\n\n")}\n`;
writeFileSync(themeCssPath, `${sections.join("\n\n")}\n`);
writeFileSync(themeCssPath, bundled);
writeFileSync(rootThemeCssPath, bundled);
for (const fileName of readdirSync(outDir)) {
if (fileName.endsWith(".js")) {