2

I am new to SCSS, but I hit a snag while converting this LESS code.

In Less

.white {background: #fff} 

.color {.white() !important}

produces

.white {background: #fff}

.color {background: #fff !important}

I am trying to replicate the behaviour in SCSS but so far all my tries have been getting syntax error.

The best I came up with in my google searches was this: Adding !important using a Compass Mixin, however, it only seems to work with mixins that have parameters. My class/mixin does not have any.

Community
  • 1
  • 1
elvista
  • 595
  • 2
  • 7
  • 17

1 Answers1

0

You can try placeholder selectors:

%white{
    background: #fff !important;
}

.color{
    @extend %white;
}

It may not be a mixin, but %white wouldn't be added to the CSS until it has been extended.

Jon Snow
  • 3,682
  • 4
  • 30
  • 51