mirror of
https://github.com/mastodon/mastodon.git
synced 2025-11-29 10:53:39 +00:00
Add experimental feature flag 'styles_with_tokens'
This commit is contained in:
parent
b43144db31
commit
a23163caba
|
|
@ -140,7 +140,14 @@ async function loadThemesFromConfig(root: string) {
|
||||||
console.warn(`Invalid theme path "${themePath}" in themes.yml, skipping`);
|
console.warn(`Invalid theme path "${themePath}" in themes.yml, skipping`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
themes[themeName] = themePath;
|
|
||||||
|
let mappedThemePath: string = themePath;
|
||||||
|
|
||||||
|
if (isStylesWithTokensEnabled()) {
|
||||||
|
mappedThemePath = themePath.replace('styles/', 'styles_new/');
|
||||||
|
}
|
||||||
|
|
||||||
|
themes[themeName] = mappedThemePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Object.keys(themes).length === 0) {
|
if (Object.keys(themes).length === 0) {
|
||||||
|
|
@ -163,3 +170,13 @@ function isThemeFile(file: string, themes: Themes) {
|
||||||
const basename = pathToThemeName(file);
|
const basename = pathToThemeName(file);
|
||||||
return basename in themes;
|
return basename in themes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isStylesWithTokensEnabled() {
|
||||||
|
// Read the ENV at plugin initialization time
|
||||||
|
const raw = process.env.EXPERIMENTAL_FEATURES ?? '';
|
||||||
|
const features = raw
|
||||||
|
.split(',')
|
||||||
|
.map((s) => s.trim())
|
||||||
|
.filter(Boolean);
|
||||||
|
return features.includes('styles_with_tokens');
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user