有没有办法让 Sass 将变量打印到终端?
最佳答案
Sass 3.3 及更早版本
有 2 个与错误相关的指令:
The @debug directive prints the value of a SassScript expression to the standard error output stream.
@debug 10em + 12em;
输出:
Line 1 DEBUG: 22em
The @warn directive prints the value of a SassScript expression to the standard error output stream. It's useful for libraries that need to warn users of deprecations or recovering from minor mixin usage mistakes.
@warn 'This is a warning';
Sass 3.4 及更高版本
The @error directive throws the value of a SassScript expression as a fatal error, including a nice stack trace. It’s useful for validating arguments to mixins and functions. For example:
@error 'This is an error';
.foo {
background: red;
}
关于logging - Sass:打印到终端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18729192/