Asimov-JS
Asimov-JS

Reputation: 16

Does SCSS supports arrays in variables?

I have a @mixin for paragraphs that looks like this:

@mixin paragraph {
    color: $dark-700;
    font-size: 14px;
    line-height: 20px;
  }

But I was wondering if it's possible to create a $paragraph variable with all those styles in an array or object to call it every time.

Upvotes: 0

Views: 186

Answers (1)

Willem-Jaap
Willem-Jaap

Reputation: 52

I'm not sure I understand your question correctly, but maybe placeholder selectors are what you are looking for:

%paragraph {
   color: $dark-700;
   font-size: 14px;
   line-height: 20px;
}

.section-description {
  @extend %paragraph;
}

.banner-text {
  @extend %paragraph;
}

More info: https://sass-lang.com/documentation/style-rules/placeholder-selectors

Upvotes: 2

Related Questions