Reputation: 145
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
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