Problem/Motivation

Component stylesheets (such as https://git.drupalcode.org/project/radix/-/blob/6.0.x/components/accordi...) currently include _init.scss (https://git.drupalcode.org/project/radix/-/blob/6.0.x/src/kits/radix_sta...). However, this excludes custom stylesheets, which are included in main.style.scss (https://git.drupalcode.org/project/radix/-/blob/6.0.x/src/kits/radix_sta...).

Proposed resolution

One way would be duplication of

@import "base/functions";
@import "base/helpers";

in every component (I believe that including of _elements.scss and _typography.scss stylesheets probably isn't needed). Perhaps there's a better way, though.

Comments

milos.kroulik created an issue. See original summary.

doxigo’s picture

The ideal way would be to use @use instead of @import for sure but Bootstrap is not yet supporting that, hopefully in bootstrap 6.x

on the other hand _init.scss contains the following:

@import "~bootstrap/scss/functions";

// Custom overrides
@import "base/variables";

// Required
@import "~bootstrap/scss/variables";
@import "~bootstrap/scss/variables-dark";
@import "~bootstrap/scss/maps";
@import "~bootstrap/scss/utilities";
@import "~bootstrap/scss/mixins";
@import "base/mixins";
@import "base/utilities";

// Optional if using rfs()
@import "~bootstrap/scss/vendor/rfs";

So that's not with _elements.scss or _typography.scss

The main reason we are including init, is to make sure we have access to our variables, mixins and so on. It might not be ideal due to lack of @use but it can be just fine as is for now, you can always remove that manually.

Unless you have a better suggestion, I think it is safe to keep it as is.

milos.kroulik’s picture

Perhaps we could import custom functions in _init-scss directly below @import "~bootstrap/scss/functions";? Looking at https://getbootstrap.com/docs/5.3/customize/sass/#importing I believe it should be fine. Helpres probably aren't needed, after all.

doxigo’s picture

I suspect we should update the init, just noticed that we are not adding the root

not sure if we can decide for each project what's needed or not. The idea is to ship with the features, people can opt-out and comment out what they don't need.

milos.kroulik’s picture

Should I create a MR?

doxigo’s picture

definitely, I would appreciate it, thanks

doxigo’s picture

Status: Active » Fixed

Pushed an update Milos, thanks for bringing this up

  • doxigo committed b2039b09 on 6.0.x
    Issue #3471365 by milos.kroulik, doxigo: Components are missing some...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.