その他の@ルール
Stylusは、@viewport
、@page
、@host
、@supports
など、ほとんどのCSS @ルールに対して、中括弧を使用しない構文を基本的にはサポートしています。
@viewport
color: #00f
@supports (display: flex)
div
display: flex
@page :blank
@top-center
content: none
@viewport
color: #00f
@supports (display: flex)
div
display: flex
@page :blank
@top-center
content: none
コンパイル結果は次のようになります。
@viewport {
color: #00f;
}
@supports (display: flex) {
div {
display: flex;
}
}
@page :blank {
@top-center {
content: none;
}
}
@viewport {
color: #00f;
}
@supports (display: flex) {
div {
display: flex;
}
}
@page :blank {
@top-center {
content: none;
}
}
未知の@ルール
Stylusは、まだ知られていない@ルールもサポートしているため、将来性があります。CSSの新しい@ルールは、Stylusのインデントベースの構文で記述でき、完璧にレンダリングされます。
@foo
@bar
width: 10px
.baz
height: 10px
@foo
@bar
width: 10px
.baz
height: 10px
コンパイル結果は次のようになります。
@foo {
@bar {
width: 10px;
.baz {
height: 10px;
}
}
}
@foo {
@bar {
width: 10px;
.baz {
height: 10px;
}
}
}