Jeroen Gerits
Jeroen Gerits

Reputation: 145

Sass 3.3 new feature @at-root doesn't seem to compile

According to Sass 3.3 release notes the following code should work.

@mixin element($name)
{
    @at-root #{&}__#{$name}
    {
        @content;
    }
}

I would like to use it for BEM syntax css generation..

But instead it throws an error:

Syntax error: Invalid CSS after "@at-root #{": expected expression (e.g. 1px, bold), was "&}__#{$name}" on line 3 of dist/mixins/_element.scss

sass --version gives Sass 3.3.1 (Maptastic Maple)

Upvotes: 0

Views: 1188

Answers (1)

Steve Sanders
Steve Sanders

Reputation: 8651

I believe you are using a slightly out of date version of the syntax. Try this:

@mixin element($name)
{
    @at-root &__#{$name}
    {
        @content;
    }
}

Upvotes: 1

Related Questions