如何动态调用一个mixin?
一个使用案例可能是生成一个样式指南:
Less CSS能否实现这样的动态调用?
一个使用案例可能是生成一个样式指南:
// The mixin which should be called
.typography-xs(){
font-family: Arial;
font-size: 16px;
line-height: 22px;
}
// The mixin which tries to call typography-xs
.typography-demo(@typographyName, @mixinName) {
@{typographyName} {
&:before{content: '@{typographyName}';}
// Calling the mixin dynamically
@mixinName();
}
}
// Example call of .typograhpy-demo
.typography-demo(xs, typography-xs);
Less CSS能否实现这样的动态调用?