安装stylus
yarn add stylus
可以通过执行npx stylus style.styl可以将styl文件转换成同名css文件
npx stylus -w style.styl 添加-w参数可以实时编译
Partial Reference
可以使用^[N]来代替部分选择选择器。
Partial reference works similar to the parent reference, but while parent reference contains the whole selector, partial selectors contain only the first merged N levels of the nested selectors, so you could access those nesting levels individually.
局部引用跟父级引用相似,但是父级引用包含了整个选择器,局部引用只包含最初的匹配上的N层嵌套的选择器,因此可以获取到逐层的选择器。
The ^[0] would give you the selector from the first level, the ^[1] would give you the rendered selector from the second level and so on:
^[0]可以获取到第一层选择器,^[1]可以获取到第二层选择器。
例如:
.foo
&__bar
width: 10px
^[0]:hover &
width: 20px
would be re