Rename theme files from *.min.css to *.css (#590)

This commit is contained in:
Nutomic 2022-03-03 17:55:26 +00:00 committed by GitHub
parent aef6a66824
commit ada4b03615
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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");