Rename theme files from *.min.css to *.css

This commit is contained in:
Felix Ableitner 2022-03-03 18:23:26 +01:00
parent aef6a66824
commit 3e505f9460
18 changed files with 10 additions and 11 deletions

File diff suppressed because one or more lines are too long

View file

@ -52,7 +52,7 @@ server.get("/robots.txt", async (_req, res) => {
server.get("/css/themes/:name", async (req, res) => { server.get("/css/themes/:name", async (req, res) => {
res.contentType("text/css"); res.contentType("text/css");
const theme = req.params.name; const theme = req.params.name;
if (!theme.endsWith(".min.css")) { if (!theme.endsWith(".css")) {
res.send("Theme must be a css file"); res.send("Theme must be a css file");
} }
@ -84,10 +84,10 @@ function buildThemeList(): string[] {
]; ];
if (fs.existsSync(extraThemesFolder)) { if (fs.existsSync(extraThemesFolder)) {
let dirThemes = fs.readdirSync(extraThemesFolder); let dirThemes = fs.readdirSync(extraThemesFolder);
let minCssThemes = dirThemes let cssThemes = dirThemes
.filter(d => d.endsWith(".min.css")) .filter(d => d.endsWith(".css"))
.map(d => d.replace(".min.css", "")); .map(d => d.replace(".css", ""));
themes.push(...minCssThemes); themes.push(...cssThemes);
} }
return themes; return themes;
} }

View file

@ -18,7 +18,7 @@ export class Theme extends Component<Props> {
<link <link
rel="stylesheet" rel="stylesheet"
type="text/css" type="text/css"
href={`/css/themes/${user.local_user_view.local_user.theme}.min.css`} href={`/css/themes/${user.local_user_view.local_user.theme}.css`}
/> />
</Helmet> </Helmet>
); );
@ -28,7 +28,7 @@ export class Theme extends Component<Props> {
<link <link
rel="stylesheet" rel="stylesheet"
type="text/css" type="text/css"
href={`/css/themes/${this.props.defaultTheme}.min.css`} href={`/css/themes/${this.props.defaultTheme}.css`}
/> />
</Helmet> </Helmet>
); );
@ -39,7 +39,7 @@ export class Theme extends Component<Props> {
<link <link
rel="stylesheet" rel="stylesheet"
type="text/css" type="text/css"
href="/css/themes/litely.min.css" href="/css/themes/litely.css"
id="default-light" id="default-light"
media="(prefers-color-scheme: light)" media="(prefers-color-scheme: light)"
/> />
@ -47,7 +47,7 @@ export class Theme extends Component<Props> {
<link <link
rel="stylesheet" rel="stylesheet"
type="text/css" type="text/css"
href="/css/themes/darkly.min.css" href="/css/themes/darkly.css"
id="default-dark" id="default-dark"
media="(prefers-color-scheme: no-preference), (prefers-color-scheme: dark)" media="(prefers-color-scheme: no-preference), (prefers-color-scheme: dark)"
/> />

View file

@ -380,7 +380,7 @@ export async function setTheme(theme: string, forceReload = false) {
document.getElementById("default-dark")?.setAttribute("disabled", "disabled"); document.getElementById("default-dark")?.setAttribute("disabled", "disabled");
// Load the theme dynamically // Load the theme dynamically
let cssLoc = `/css/themes/${theme}.min.css`; let cssLoc = `/css/themes/${theme}.css`;
loadCss(theme, cssLoc); loadCss(theme, cssLoc);
document.getElementById(theme).removeAttribute("disabled"); document.getElementById(theme).removeAttribute("disabled");