<html> <head> <link rel="stylesheet" href="style.css" type="text/css" /> <title>Guarded Namespaces</title> </head> <body> <h2>Welcome to Yiibai Yiibai</h2> <p>This will paragraph be displayed red, when (@color = blue) in style.less and when color is other than blue, then this paragraph will be default black.</p> </body> </html>
@import "http://www.yiibai.com/less/lib.less";
#namespace when (@color = blue) {
.mixin() {
color: red;
}
}
p{
#namespace .mixin();
}
@color: blue;
lessc style.less style.css
p {
color: red;
}