about summary refs log tree commit diff
path: root/config/webpack/configuration.js
diff options
context:
space:
mode:
Diffstat (limited to 'config/webpack/configuration.js')
-rw-r--r--config/webpack/configuration.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/config/webpack/configuration.js b/config/webpack/configuration.js
index 822329490..606eb97f1 100644
--- a/config/webpack/configuration.js
+++ b/config/webpack/configuration.js
@@ -1,16 +1,27 @@
 // Common configuration for webpacker loaded from config/webpacker.yml
 
-const { join, resolve } = require('path');
+const { dirname, join, resolve } = require('path');
 const { env } = require('process');
 const { safeLoad } = require('js-yaml');
 const { readFileSync } = require('fs');
+const glob = require('glob');
 
 const configPath = resolve('config', 'webpacker.yml');
 const loadersDir = join(__dirname, 'loaders');
 const settings = safeLoad(readFileSync(configPath), 'utf8')[env.NODE_ENV];
+const themeFiles = glob.sync('app/javascript/themes/*/theme.yml');
+const themes = {};
 
-const themePath = resolve('config', 'themes.yml');
-const themes = safeLoad(readFileSync(themePath), 'utf8');
+for (let i = 0; i < themeFiles.length; i++) {
+  const themeFile = themeFiles[i];
+  const data = safeLoad(readFileSync(themeFile), 'utf8');
+  if (!data.pack_directory) {
+    data.pack_directory = dirname(themeFile);
+  }
+  if (data.name && data.pack) {
+    themes[data.name] = data;
+  }
+}
 
 function removeOuterSlashes(string) {
   return string.replace(/^\/*/, '').replace(/\/*$/, '');