Re: [Sass] Using ampersand (&) for class concatenation

2,121 views
Skip to first unread message

Nathan Weizenbaum

unread,
Dec 3, 2012, 2:48:17 PM12/3/12
to sass...@googlegroups.com
There will be: https://github.com/nex3/sass/issues/286

On Mon, Dec 3, 2012 at 6:15 AM, Dave Taylor <da...@the-taylors.org> wrote:

I write my css in a similar style to the BEM syntax where you have a block class (eg .person) and then an element class which (eg .person__hand). I have recently been trying SASS after using LESS and Stylus and was expecting the following to work but it errors.

.foo {
    &__bar {
        background: green;
    }
}

My epected result was

.foo__bar { background: green; }

The error I get is

Sass Error: Invalid CSS after "    &": expected "{", was "__bar {"

"__bar" may only be used at the beginning of a compound selector.

Is there another way of doing this in SASS?

--
You received this message because you are subscribed to the Google Groups "Sass" group.
To view this discussion on the web visit https://groups.google.com/d/msg/sass-lang/-/U6lH1aWPTewJ.
To post to this group, send email to sass...@googlegroups.com.
To unsubscribe from this group, send email to sass-lang+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sass-lang?hl=en.

Dave Taylor

unread,
Dec 4, 2012, 6:25:45 AM12/4/12
to sass...@googlegroups.com
Thanks nathan :o)
Reply all
Reply to author
Forward
0 new messages