SASS Concatenate class name?

后端 未结 2 1867
渐次进展
渐次进展 2021-01-14 16:19

I got a LESS file from this a Date-picker plugin and want to convert it to SASS.

But in the LESS, it concates a class name like this:

//LESS
.dropdow         


        
相关标签:
2条回答
  • 2021-01-14 16:39

    This is not possible before version 3.2 but will be eventually. Just like LESS, the syntax will use &.

    With updated scss, you can now use the interpolation syntax &-- to DRY up your style files.

    0 讨论(0)
  • 2021-01-14 16:49

    Just moved from css to scss I ran in to this question and was disappointed until I found out it is not up-to-date. Found the correct answer here: https://css-tricks.com/the-sass-ampersand/#article-header-id-12.

    It is now possible with the following syntax:

    .add-some {
        &-red {
            color: red;
        }
    }
    

    Results, as expected, to:

    .add-some-red {
        color: red;
    }
    
    0 讨论(0)
提交回复
热议问题