Ответ 1
Как Sass 3.4.0, там @error
, которую вы можете использовать, чтобы вызвать фатальную ошибку:
$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; }