A web page can be viewed as an assembly of blocks, where the theme provides the necessary styles for its presentation.
The traditional approach is to integrate styles directly into the theme. However, for evolving sites (adding new sections or pages), this method makes maintenance particularly complex after several months or even years.
Our approach is based on the use of two separate style files:
- A file containing the basic styles.
- A file whose content is dynamically generated based on the active sections.
In the Drupal environment, this method is implemented through the use of layouts that integrate styles (SCSS/JS). Any entity compatible with the layouts can thus have its own styles. This also allows sections to be reused on different sites.
One notable drawback:
This approach requires configuring an environment that follows a specific logic.
Required modules and themes:
These modules include additional dependencies, which are downloaded automatically.
You can also use the installation profile: Drupal Project Habeuk.