截至Sass 3.4.0,有一個@error
指令,你可以用它來產生一個致命的錯誤:如果您嘗試在shell編譯這個
$stuff: fubar;
@if ($stuff == fubar) {
@error "stuff is fubar";
}
,你會看到以下內容:
$ sass test.scss
Error: stuff is fubar
on line 3 of test.scss
Use --trace for backtrace.
也有相關的@warn
和@debug
指令,這些指令在語言中使用時間較長,以防這些指令對您更有用。例如:
@debug "stuff is happening";
@warn "stuff is happening that probably shouldn't be happening";
/*
Note that these directives do not terminate execution, and this block
will therefore still be output.
*/
* {
color: pink;
}
當編譯:
$ sass test2.scss
test2.scss:1 DEBUG: stuff is happening
WARNING: stuff is happening that probably shouldn't be happening
on line 2 of test2.scss
/*
Note that these directives do not terminate execution, and this block
will therefore still be output.
*/
* {
color: pink; }
你嘗試在看文檔? http://sass-lang.com/documentation/file.SASS_REFERENCE.html#_5 – cimmanon
我做到了,但我錯過了這一點 - 謝謝 – wheresrhys