Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The logic of the module does not correspond to SMACSS #324

Open
kvantstudio opened this issue Mar 9, 2021 · 1 comment
Open

The logic of the module does not correspond to SMACSS #324

kvantstudio opened this issue Mar 9, 2021 · 1 comment

Comments

@kvantstudio
Copy link

All components have the CSS_AGGREGATE_DEFAULT group, and must have CSS_AGGREGATE_THEME. The CSS files of the components are loaded before the CSS files of the theme. This is a big mistake! So far, the solution to the problem is the following. Now i use hook_css_alter

function hook_css_alter(&$css, \Drupal\Core\Asset\AttachedAssetsInterface $assets) {  
  foreach ($css as $path => $item) {
    if (preg_match("/templates\/patterns/", $path)) {
      $css[$path]['group'] = CSS_AGGREGATE_THEME;
    }
  }
}
@geek-andi
Copy link

I can confirm this. Also setting the smacss in the component library definition - as described in the docs - does not seem to have any effect:

  libraries:
    - lb_columns:
       css:
         theme:
           lb_columns.css: {}

I would be interested if there is any reasoning behind the module behavior. I could think of that components can live in modules or themes so it would probably not appropriate to set component css always to theme.

Find the reference to drupal css architecture: https://www.drupal.org/docs/develop/standards/css/css-architecture-for-drupal-9#separate-concerns

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants