From f3b9a2b590147c8b383b9db7e46684e89d74ad69 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 11 Feb 2022 23:52:42 +0100 Subject: [PATCH] Add support for multiple source files per pack --- app/controllers/concerns/theming_concern.rb | 2 +- config/webpack/shared.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/controllers/concerns/theming_concern.rb b/app/controllers/concerns/theming_concern.rb index 425554072c..f993a81d72 100644 --- a/app/controllers/concerns/theming_concern.rb +++ b/app/controllers/concerns/theming_concern.rb @@ -20,7 +20,7 @@ module ThemingConcern end def valid_pack_data?(data, pack_name) - data['pack'].is_a?(Hash) && [String, Hash].any? { |c| data['pack'][pack_name].is_a?(c) } + data['pack'].is_a?(Hash) && data['pack'][pack_name].present? end def nil_pack(data) diff --git a/config/webpack/shared.js b/config/webpack/shared.js index de347fa888..c2a108a894 100644 --- a/config/webpack/shared.js +++ b/config/webpack/shared.js @@ -16,10 +16,16 @@ function reducePacks (data, into = {}) { const pack = data.pack[entry]; if (!pack) continue; - const packFile = typeof pack === 'string' ? pack : pack.filename; + let packFiles = []; + if (typeof pack === 'string') + packFiles = [pack]; + else if (Array.isArray(pack)) + packFiles = pack; + else + packFiles = [pack.filename]; - if (packFile) { - into[data.name ? `flavours/${data.name}/${entry}` : `core/${entry}`] = resolve(data.pack_directory, packFile); + if (packFiles) { + into[data.name ? `flavours/${data.name}/${entry}` : `core/${entry}`] = packFiles.map(packFile => resolve(data.pack_directory, packFile)); } }