mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-12-23 11:21:26 +00:00
Rename theme files from *.min.css to *.css (#590)
This commit is contained in:
parent
aef6a66824
commit
ada4b03615
18 changed files with 10 additions and 11 deletions
1
src/assets/css/themes/darkly.min.css
vendored
1
src/assets/css/themes/darkly.min.css
vendored
File diff suppressed because one or more lines are too long
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -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");
|
||||||
|
|
Loading…
Reference in a new issue