Change how theme style packs are loaded

Load the `common` style pack, and then charge the style pack for the current
skin, independent from any selected JS pack.
This commit is contained in:
Claire
2024-04-27 22:34:41 +02:00
parent 93cdc66e64
commit c3e12a4dfa
18 changed files with 82 additions and 84 deletions

View File

@@ -1,7 +1,7 @@
// Common configuration for webpacker loaded from config/webpacker.yml
const { lstatSync, readFileSync } = require('fs');
const { basename, dirname, extname, join, resolve } = require('path');
const { basename, dirname, join, resolve } = require('path');
const { env } = require('process');
const glob = require('glob');
@@ -37,12 +37,13 @@ skinFiles.forEach((skinFile) => {
const data = flavours[name].skin;
if (lstatSync(skinFile).isDirectory()) {
data[skin] = {};
const skinPacks = glob.sync(join(skinFile, '*.{css,scss}'));
// TODO: more cleanly take the first match
const skinPacks = glob.sync(join(skinFile, '{common,index,application}.{css,scss}'));
skinPacks.forEach((pack) => {
data[skin][basename(pack, extname(pack))] = pack;
data[skin] = pack;
});
} else if ((skin = skin.match(/^(.*)\.s?css$/i))) {
data[skin[1]] = { common: skinFile };
data[skin[1]] = skinFile;
}
});