在为大型开发人员团队维护和更新mixins时,是否可以不赞成使用mixins,以便在编译样式时它们会发出某种警告?
我不只是要删除已弃用的mixins,因为删除所有当前使用将花费一些时间,但是最好警告其他开发人员,如果他们尝试使用它,则将其删除。
最佳答案
您可以为此使用@warn
指令。从SASS documentation:
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.
您可以这样使用它:
@mixin old-mixin {
@warn "This old mixin is deprecated!";
// mixin definition here
}
关于sass - 是否可以不赞成使用sass/scss mixin?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12714020/