mirror of
https://github.com/lutinglt/gitea-github-theme.git
synced 2025-10-26 13:00:31 +00:00
update vite
This commit is contained in:
@@ -17,16 +17,15 @@ const suffix = ".css.tsx";
|
||||
export function themeInput(
|
||||
outDir: string,
|
||||
themeDir: string,
|
||||
devTheme: string,
|
||||
mode: string
|
||||
): { [key: string]: string } {
|
||||
const hash = crypto.randomBytes(6).toString("hex");
|
||||
const tmpDir = `${outDir}/tmp-${hash}`; // 输出目录下的临时目录
|
||||
|
||||
fs.mkdirSync(tmpDir, { recursive: true });
|
||||
|
||||
const input: { [key: string]: string } = {};
|
||||
const themeEntries = fs.readdirSync(themeDir, { withFileTypes: true });
|
||||
const devTheme = process.env.DEV_THEME || "dark"; // 开发模式仅打包单个颜色主题
|
||||
|
||||
for (const entry of themeEntries) {
|
||||
// 目录下所有的 css.ts 文件都作为主题入口
|
||||
|
||||
@@ -13,7 +13,6 @@ dotenv.config({ quiet: true });
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
const devTheme = process.env.DEV_THEME || "dark"; // 开发模式仅打包单个颜色主题
|
||||
const outDir = "dist"; // 输出目录
|
||||
const themesDir = "themes"; // 颜色主题目录
|
||||
|
||||
@@ -54,7 +53,7 @@ export default defineConfig(({ mode }) => {
|
||||
cssCodeSplit: true,
|
||||
outDir: outDir,
|
||||
rollupOptions: {
|
||||
input: themeInput(outDir, themesDir, devTheme, mode),
|
||||
input: themeInput(outDir, themesDir, mode),
|
||||
output: {
|
||||
assetFileNames: "[name].[ext]",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user