Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295445

Support CSS custom properties in attachments

$
0
0

Drupal 10 has dropped support for Internet Explorer which means CSS custom properties are fully supported by all browsers that Drupal supports.

Passing backend settings to frontend is quite common task when you need content managers to be able to change site appearance.
Currently it is typically implemented through preprocess variables which is kind of tedious.

Proposed solution

Support attaching CSS properties same way as JS settings.

'#attached': [
  'drupalProperties': [
    ':root': [
      'bg-color': 'pink',
    ],
  ],
],

On FE side it should look like this.

<style>
  :root {--bg-color: pink}
</style>

Viewing all articles
Browse latest Browse all 295445


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>