about summary refs log tree commit diff
path: root/config/webpack/configuration.js
diff options
context:
space:
mode:
authorbeatrix <beatrix.bitrot@gmail.com>2017-09-28 21:48:28 -0400
committerGitHub <noreply@github.com>2017-09-28 21:48:28 -0400
commitc027a7bd4d7b5af21f4b201d656f7251fa3606a1 (patch)
treece2c2327b26358c26cb899ea918988af373ca6d6 /config/webpack/configuration.js
parent210e6776fce016666ecfd248b2208c487f3440f9 (diff)
parent53f829dfa8bc376041a442dc84c22aa1cbfcb9d0 (diff)
Merge pull request #157 from glitch-soc/merging-upstream
ABRACA-HRRRRRRRRRRRNGGGGGGGHHH!!!!!!!!!!!!!!!!!!!
Diffstat (limited to 'config/webpack/configuration.js')
-rw-r--r--config/webpack/configuration.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/config/webpack/configuration.js b/config/webpack/configuration.js
index 6ef484c3a..606eb97f1 100644
--- a/config/webpack/configuration.js
+++ b/config/webpack/configuration.js
@@ -1,13 +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 = {};
+
+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(/\/*$/, '');
@@ -29,6 +43,7 @@ const output = {
 
 module.exports = {
   settings,
+  themes,
   env,
   loadersDir,
   output,