Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/28152/head
Michael Telatynski 2024-10-08 10:28:51 +01:00
parent 36285699ac
commit 2a33d553e4
No known key found for this signature in database
GPG Key ID: A2B008A5F49F5D0D
2 changed files with 2 additions and 38 deletions

View File

@ -1,14 +0,0 @@
# To use the full page error dialog, set this to 1. Please report false positives to
# the issue tracker for handling.
FULL_PAGE_ERRORS=0
# To use a single theme, uncomment the line with the theme you want to hot-reload.
MATRIX_THEMES='light'
#MATRIX_THEMES='dark'
#MATRIX_THEMES='legacy-light'
#MATRIX_THEMES='legacy-dark'
#MATRIX_THEMES='light-custom'
#MATRIX_THEMES='dark-custom'
# You can also enable multiple themes by using a comma-separated list.
# When multiple themes are enabled, switching between them may require a full page reload.
# Note that compilation times are proportional to the number of enabled themes.
#MATRIX_THEMES='light,dark'

View File

@ -36,15 +36,6 @@ const cssThemes = {
"theme-dark-custom": "./node_modules/matrix-react-sdk/res/themes/dark-custom/css/dark-custom.pcss", "theme-dark-custom": "./node_modules/matrix-react-sdk/res/themes/dark-custom/css/dark-custom.pcss",
}; };
function getActiveThemes() {
// Default to `light` theme when the MATRIX_THEMES environment variable is not defined.
const theme = process.env.MATRIX_THEMES ?? "light";
return theme
.split(",")
.map((x) => x.trim())
.filter(Boolean);
}
// See docs/customisations.md // See docs/customisations.md
let fileOverrides = { let fileOverrides = {
/* {[file: string]: string} */ /* {[file: string]: string} */
@ -129,19 +120,6 @@ module.exports = (env, argv) => {
const reactSdkSrcDir = path.resolve(require.resolve("matrix-react-sdk/package.json"), "..", "src"); const reactSdkSrcDir = path.resolve(require.resolve("matrix-react-sdk/package.json"), "..", "src");
const jsSdkSrcDir = path.resolve(require.resolve("matrix-js-sdk/package.json"), "..", "src"); const jsSdkSrcDir = path.resolve(require.resolve("matrix-js-sdk/package.json"), "..", "src");
const ACTIVE_THEMES = getActiveThemes();
function getThemesImports() {
const imports = ACTIVE_THEMES.map((t) => {
return cssThemes[`theme-${t}`].replace("./node_modules/", ""); // theme import path
});
const s = JSON.stringify(ACTIVE_THEMES);
return `
window.MX_insertedThemeStylesCounter = 0;
window.MX_DEV_ACTIVE_THEMES = (${s});
${imports.map((i) => `import("${i}")`).join("\n")};
`;
}
return { return {
...development, ...development,
@ -598,8 +576,8 @@ module.exports = (env, argv) => {
// This exports our CSS using the splitChunks and loaders above. // This exports our CSS using the splitChunks and loaders above.
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
filename: "bundles/[name].css", filename: "bundles/[fullhash]/[name].css",
chunkFilename: "bundles/[name].css", chunkFilename: "bundles/[fullhash]/[name].css",
ignoreOrder: false, // Enable to remove warnings about conflicting order ignoreOrder: false, // Enable to remove warnings about conflicting order
}), }),