質問編集履歴
1
例の追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,11 +1,25 @@
|
|
1
1
|
sassで@at-rootを使用したmixinを作りたいのですが、下記のように引数にクラスやIDを指定した場合、**__.foo__**のようにクラスの記号含むとコンパイルエラーになります。
|
2
|
-
|
2
|
+
|
3
3
|
どのように記述すれば**__.foo__**でもコンパイルされるでしょうか?
|
4
4
|
|
5
|
+
### **__#bar__**はエラーにならないが__.foo__でエラーになる
|
5
6
|
```scss
|
6
7
|
@mixin at-root($class) {
|
7
8
|
@at-root #{$class} #{&} {
|
8
9
|
@content;
|
9
10
|
}
|
10
11
|
}
|
12
|
+
|
13
|
+
@include at-root(.foo) {....}
|
14
|
+
```
|
15
|
+
|
16
|
+
### __foo__だけにすればエラーにならないが、クラスしか指定できない。idも指定したい。
|
17
|
+
```scss
|
18
|
+
@mixin at-root($class) {
|
19
|
+
@at-root .#{$class} #{&} {
|
20
|
+
@content;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
@include at-root(foo) {....}
|
11
25
|
```
|