From 3a0cbbe67182da9366e4e018b9a22392e48c726d Mon Sep 17 00:00:00 2001 From: Leandro Pereira Date: Thu, 1 Aug 2024 19:09:32 -0400 Subject: [PATCH] ignore if not found in case of invalid config or running on test env --- assets/tailwind.config.js | 16 ++++++++++++---- priv/tailwind.config.bundle.js | 15 +++++++++++---- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/assets/tailwind.config.js b/assets/tailwind.config.js index 76a27aa7..3f3132d4 100644 --- a/assets/tailwind.config.js +++ b/assets/tailwind.config.js @@ -29,16 +29,24 @@ export default { // See your `CoreComponents.icon/1` for more information. // plugin(function ({ matchComponents, theme }) { + let values = {} + let iconsDir = null + // Copy from host app deps. - let iconsDir = path.join(__dirname, "../../heroicons/optimized") + let hostIconsDir = path.join(__dirname, "../../heroicons/optimized") // Copy from release. // Adjust for Umbrella apps. See the Heroicons guide for more info. - if (!fs.existsSync(iconsDir)) { - iconsDir = path.join(__dirname, "../../../vendor/heroicons/optimized") + let releaseIconsDir = path.join(__dirname, "../../../vendor/heroicons/optimized") + + if (fs.existsSync(hostIconsDir)) { + iconsDir = hostIconsDir + } else if (fs.existsSync(releaseIconsDir)) { + iconsDir = releaseIconsDir + } else { + return matchComponents({ hero: ({ _name, _fullPath }) => {} }, { values }) } - let values = {} let icons = [ ["", "/24/outline"], ["-solid", "/24/solid"], diff --git a/priv/tailwind.config.bundle.js b/priv/tailwind.config.bundle.js index 94bacb90..ce24723d 100644 --- a/priv/tailwind.config.bundle.js +++ b/priv/tailwind.config.bundle.js @@ -8266,11 +8266,18 @@ var tailwind_config_default = { // See your `CoreComponents.icon/1` for more information. // plugin(function({ matchComponents, theme }) { - let iconsDir = path.join(__dirname, "../../heroicons/optimized"); - if (!fs.existsSync(iconsDir)) { - iconsDir = path.join(__dirname, "../../../vendor/heroicons/optimized"); - } let values = {}; + let iconsDir = null; + let hostIconsDir = path.join(__dirname, "../../heroicons/optimized"); + let releaseIconsDir = path.join(__dirname, "../../../vendor/heroicons/optimized"); + if (fs.existsSync(hostIconsDir)) { + iconsDir = hostIconsDir; + } else if (fs.existsSync(releaseIconsDir)) { + iconsDir = releaseIconsDir; + } else { + return matchComponents({ hero: ({ _name, _fullPath }) => { + } }, { values }); + } let icons = [ ["", "/24/outline"], ["-solid", "/24/solid"],