Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using SASS & reference for OOCSS

Tags:

css

sass

less

oocss

Usually i use LESS for my projects but now im trying to go with SASS.

In LESS i do things like this

.module {
  background-color: blue;

  &-title {
    color: black;
  }

  &-type-2 {
    background-color: red;
  }
}

and the output CSS will be

.module { 
  background-color: blue;
}

.module-title {
  color: black;
}

.module-type-2 {
  background-color: red;
}

In SASS wont work, there is someway to do it in SASS?

like image 320
Oswaldo Acauan Avatar asked Apr 30 '26 00:04

Oswaldo Acauan


1 Answers

As of Sass 3.3, you can do that with the following syntax:

.block{
    &__element {
      // ...
    }
    &--modifier {
      // ...
    }
}
like image 180
cimmanon Avatar answered May 01 '26 16:05

cimmanon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!