Theme developers are forced to use SMACSS

Created on 13 May 2015, about 10 years ago
Updated 9 April 2023, about 2 years ago

Problem/Motivation

We've created a way to organize CSS files - great! Its working but the problem we should have learned is that if we decide to use some technology on the frontend now, it will get old in few years and it needs to be replaced. I'm sure there will be and is other standards than SMACSS that people would like to use to define the order of CSS files.

Proposed resolution

Create a way to define own CSS groups with their weights. It makes it possible to easily define new CSS architectures when someone wants to use something else than SMACSS.

Remaining tasks

TBD

User interface changes

TBD

API changes

TBD

Feature request
Status

Active

Version

10.1

Component
Asset library 

Last updated about 4 hours ago

No maintainer
Created by

🇫🇮Finland lauriii Finland

Live updates comments and jobs are added and updated live.
  • CSS

    It involves the content or handling of Cascading Style Sheets.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇫🇷France dqd London | N.Y.C | Paris | Hamburg | Berlin

    @laurii: Amen!! Word!

    Just found this here because I was about to start an issue but saw now by searching that it already exist. And since laurii already perfectly outlined the issue I think I just can add the css comment I put in the head of all libraries yml files of all our themes.

      1 # Main theme library.
      2 # The SMACSS nesting layout is required (sadly).
      3 # That's why the theme: subgroup comes in here.
      4 # Which makes no sense at this level since Drupal should
      5 # rather provide as a flexible theme "connector" here.
      6 # We repeat mistakes we made in Drupal versions before
      7 # and force inhouse outlining on middleware levels.
      8 # Not all frameworks can follow or can be re-outlined
      9 # to this or are already outlined before this level.
    10 # Feel free the rename or re-outline but one nesting level
    11 # is sadly required.
    

    The world of web is full of such ideas like SMACSS and yes even me had some motivation 10 years ago to start a CSS outlining project called QCSS and all this ideas are wonderful. But we should learn that it is not for everyone and especially - and this is the most important think to learn - not for every scenario. I can't count no more how often I sad that. Also in other topics like headless Drupal, OOP, package and dependency managers of programming or scripting language engines and so on. All very important innovations and improvements in Web development technologies or programming/scripting languages on other enviroments. But everything has always to be taken with a grain of salt and the day will come where disadvantages start to pop up. SMACSS is great but some theming frameworks maybe used it already a level before and after sass compiling delivers only one CSS file? In this case the additional theme: subgroup is just for the purpose to keep the library file functioning.

    Otherwise the library file will simply not be loaded. This is why this issue is still up-to-date.

  • 🇫🇷France dqd London | N.Y.C | Paris | Hamburg | Berlin

    Since this pattern is very deeply seated into Drupal it is rather a complete paradigm change we discuss here. Not only a change on the outter surfaces of the theming layer. Not sure if this will enter any serious progress any soon. But still, I strongly advocate for seriously reconsidering it.

    From my findings following the functioning and its connections it leads from
    core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
    to
    core/includes/common.inc
    where the constants based on SMACSS and for other default weighting purposes are defined already.

Production build 0.71.5 2024