截至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