mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-12-27 11:08:30 +00:00
Fix buildThemeList() function to ensure no duplicates (#1466)
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
This commit is contained in:
parent
902930bb9d
commit
0247f8a2cf
|
@ -4,15 +4,20 @@ import { readdir } from "fs/promises";
|
|||
const extraThemesFolder =
|
||||
process.env["LEMMY_UI_EXTRA_THEMES_FOLDER"] || "./extra_themes";
|
||||
|
||||
const themes = ["darkly", "darkly-red", "litely", "litely-red"];
|
||||
const themes: ReadonlyArray<string> = [
|
||||
"darkly",
|
||||
"darkly-red",
|
||||
"litely",
|
||||
"litely-red",
|
||||
];
|
||||
|
||||
export async function buildThemeList(): Promise<string[]> {
|
||||
export async function buildThemeList(): Promise<ReadonlyArray<string>> {
|
||||
if (existsSync(extraThemesFolder)) {
|
||||
const dirThemes = await readdir(extraThemesFolder);
|
||||
const cssThemes = dirThemes
|
||||
.filter(d => d.endsWith(".css"))
|
||||
.map(d => d.replace(".css", ""));
|
||||
themes.push(...cssThemes);
|
||||
return themes.concat(cssThemes);
|
||||
}
|
||||
return themes;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue