Why doesn’t my Sass compile this code?

Asked

Viewed 18 times

-1

.button {
    //background-color: $button-blue-bg;
    color: $button-font-color;
    font-size: $button-font-size;
    position: relative;
    display: block;
    text-align: center;
    line-height: 20px;
    padding: 0 12px;
    border-radius: 8px;
    background-image: url('../assets/ui/button-blue-center.png');
    background-repeat: no-repeat;
    background-size: cover;
    @include no-select();

    &:before, &:after {
        content: ' ';
        background-repeat: no-repeat;
        background-size: cover;
        position: absolute;
        top: 0;
        width: 8px;
        height: 20px;
    }

    &:before {
        background-image: url('../assets/ui/button-blue-left.png');
        left: 0px;
    }

    &:after {
        background-image: url('../assets/ui/button-blue-right.png');
        right: 0px;
    }
}

.button.blue-alt {
    background-image: url('../assets/ui/button.b1.middle.active.png');
    background-repeat: repeat-x;
    background-size: 100% 100%;
    display: inline-block;
    min-width: 40px;

    &:before {
        background-image: url('../assets/ui/button.b1.left.active.png');
        left: 0px;
    }

    &:after {
        background-image: url('../assets/ui/button.b1.right.active.png');
        right: 0px;
    }
}

What’s the mistake?

1 answer

1


There are three errors in your code:

  • The variable $button-font-color was not declared.

    Undefined variable. stdin 3:12 root stylesheet on line 3 at column 12

  • The variable $button-font-size was not declared.

    Undefined variable. stdin 5:16 root stylesheet on line 5 at column 16

  • The mixin no-select not declared / not imported ( @import )

    Undefined mixin. stdin 16:5 root stylesheet on line 16 at column 5

To resolve, just make the statement:

$button-font-color: green;
$button-font-size: 1;

@mixin no-select()
{
    font-size: 10px;
}

// aqui vem o restante do código
.button {
    //background-color: $button-blue-bg;
    color: $button-font-color;
    font-size: $button-font-size;
...

Reference

Browser other questions tagged

You are not signed in. Login or sign up in order to post.