lundi 22 mai 2017

SASS @if statement using variable name

I'm having an issue generating the correct code with the @if statement based on a variable.

SASS

    =band($name, $color)
      .band-#{$name}
        background-color: #{$color}
        @if $name == white
          font-size: 100px
        @else
          font-size: 20px

    +band('white', $white)
    +band('black', $black)

to generate

    .band-white{background-color:white; font-size:100px;}
    .band-black{background-color:black; font-size:50px;}

Aucun commentaire:

Enregistrer un commentaire