D
D
Dmitry Klimantovich2019-09-02 18:29:46
Sass
Dmitry Klimantovich, 2019-09-02 18:29:46

How to override the mixin parameter without touching the source code?

Good afternoon.
The sources contain such a mixin buttons.scss It looks like this:

@mixin button-variant($background, $border, $hover-background: darken($background, 7.5%), $hover-border: darken($border, 10%), $active-background: darken($background, 10%), $active-border: darken($border, 12.5%)) {
  color: color-yiq($background);
  @include gradient-bg($background);
  border-color: $border;
  @include box-shadow($btn-box-shadow);

  @include hover {
    color: color-yiq($hover-background);
    @include gradient-bg($hover-background);
    border-color: $hover-border;
  }

How can I reassign the $active-background and $active-border variable in my custom.scss?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Flying, 2019-09-02
@Flying

You can pass it as a named argument when called, i.e.

@include button-variant($active-background: white, $active-border: lightgrey);

D
Dmitry Klimantovich, 2019-09-03
@dikey58

Flying but in this case you will have to create a new class of buttons and call the mixin in them. Are there no other options for me to override the $hover-background of the buttons with color-yiq instead of the default dimming?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question