Problem/Motivation
When installing the theme, there are some warnings about files not existing.
The errors are as follows:
Warning: file_get_contents(core/../themes/contrib/eureka/components/03-organisms/item-list/latest-news/latest-news.min.css): Failed to open stream: No such file or directory in Drupal\Core\Asset\CssCollectionOptimizerLazy->generateHash() (line 43 of core/lib/Drupal/Core/Asset/AssetGroupSetHashTrait.php).
Warning: file_get_contents(core/../themes/contrib/eureka/components/02-molecules/card/news-card/card.min.js): Failed to open stream: No such file or directory in Drupal\Core\Asset\JsCollectionOptimizerLazy->generateHash() (line 43 of core/lib/Drupal/Core/Asset/AssetGroupSetHashTrait.php).
Steps to reproduce
Install the theme and see errors in dblog or shown on the page when logged in as admin.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork eureka-3577725
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
velmir_taky commentedRoot cause analysis:
The Eureka theme's build system (
scripts/minify.cjs) generates.min.cssfrom each.csssource file and.min.jsfrom each.jssource file. Three SDC components havelibraryOverridesentries referencing.minfiles that were never generated because the source files don't exist:1.
latest-news— declareslibraryOverridesforlatest-news.min.css, but this component has no CSS source file. It is a pure Twig wrapper ({% embed "eureka:item-list" %}) that relies entirely on the parentitem-listcomponent's styles. ThelibraryOverridesblock was copy-pasted from a component that does have CSS (likestaff-cards).2.
external-cards— same situation: declareslibraryOverridesforexternal-cards.min.csswith no CSS source. Also a pure Twig wrapper arounditem-list. (Not mentioned in the original report but same root cause.)3.
news-card— the CSS override (news-card.min.css) is correct, but the JS override referencescard.min.js. SDC resolves paths relative to the component's own directory, so it looks fornews-card/card.min.jswhich doesn't exist. The actual file is in the parentcard/directory, and the JS is already loaded via{{ attach_library('eureka/card') }}innews-card.twig.These warnings only appear when CSS/JS aggregation is enabled. Drupal core's AssetGroupSetHashTrait::generateHash() calls file_get_contents() without error suppression to compute content hashes, which triggers the PHP warnings for missing files.
Fix:
Remove the erroneous
libraryOverridesentries:-
latest-news.component.yml— remove entirelibraryOverridesblock-
external-cards.component.yml— remove entirelibraryOverridesblock-
news-card.component.yml— remove only thejssection fromlibraryOverrides(keep the valid CSS override)Comment #5
nexusnovaz commentedThanks for the work. This is currently wip and im just awaiting some more information from the other maintainers to see the direction we wanted to take this in.
Many thanks!
Comment #6
psebborn commentedLooks good to me - approved
Comment #7
velmir_taky commentedComment #8
psebborn commentedRTBC - all good!
Comment #10
nexusnovaz commentedThanks for the work all