Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
We use global "importFrom" setting from 'postcss-custom-properties'
. This doesn't work in core because this would lead into leaking our variables to the local CSS scope.
Proposed resolution
Import variables.css
manually to make it specific to Claro even when PostCSS is being compiled in a larger scope.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#5 | 3084189-5.claro_.Import-variablescss-manually.patch | 18.97 KB | fhaeberle |
| |||
#5 | interdiff.3084189.4-5.txt | 1.37 KB | fhaeberle |
#4 | interdiff.txt | 2.9 KB | lauriii |
#4 | claro-postcss-import-3084189-4.patch | 18.97 KB | lauriii |
| |||
#2 | claro-postcss-import-3084189-2.patch | 16.07 KB | lauriii |
|
Comments
Comment #2
lauriiiThis is where I got with this. Only downside I could tell with this approach is that the manual import leads into empty
:root
selector at the beginning of the file. This seems like a minor problem which we could try to address in a follow-up.Comment #3
huzookaAs I see, this patch imports variables only for some assets inside the
css/src/components
folder, but we use those vars elsewhere as well (layout
,theme
).Assets that will miss variables after patch #2:
My recommendation: import
base/variables.css
in every asset, unconditionally.Comment #4
lauriiiFixed ✌️
Not sure which way is better. I'd keep it so that only files using variables has the import to not cause any potential for confusion. It would be also hard to enforce this in core.
Comment #5
fhaeberleReviewed this! In some places, there were still imports missing and in some places I deleted the import because they aren't any variables being used in the particular file. Leaving on needs review because of new patch.
Comment #6
huzookaAfter applied #5 and post-processed out assets, I cannot find any
var()
usage in thecss/dist
folder anymore.Comment #8
lauriiiThank you! Committed! 🚀