Problem/Motivation
If a theme's colour scheme is changed, a stylesheet (specifically colours.css
and also logo.svg
) is created in /sites/default/files/color/bartik-[hash]/ and a new directory with a different hash is used each time.
When using config synchronisation, the color.theme.bartik.yml file is copied, but the default .gitignore file excludessites/*/files, therefore the production server will be missing the required CSS and have a mostly a mostly white page.
Visiting /admin/appearance/settings/bartik on production and clicking Save Configuration will fix the site, but unfortunately will also generate a new directory with a different hash and a new .yml file on config export, further complicating matters.
Proposed resolution
The color module already implements a ColorConfigCacheInvalidator event subscriber that listens to config changes. And we also may have config overrides for domains (and at least in theory we can have colors per language ;-) . To support all these:
* factor out file generation
* make the target location predictable by using a deterministic hash
* Regenerate files if needed in hook_library_info_alter() (so this is triggered by ColorConfigCacheInvalidator too)
Remaining tasks
- Write simple patch
User interface changes
None.
API changes
None.
Data model changes
None.