jeremieca
jeremieca

Reputation: 1188

Namespace interpolation in Less

Is it possible to use namespace interpolation in Less ?

 @color: "yellow";

 #top-yellow {
   .square(@param) {
     width: @param;
     height: @param;
   }
 }

 .example {
     #top-@color;                   // Use of #top-yellow namespace
     .square(10px);
 }

Thanks !

Upvotes: 1

Views: 51

Answers (1)

seven-phases-max
seven-phases-max

Reputation: 11820

Use parametric namespace instead (Notice namespaces and mixins are actually the same thing - i.e. the former is a purely logical abstraction).

@color: yellow;

 #top(yellow) {
     .square(@param) {
         width: @param;
         height: @param;
     }
 }

 .example {
     #top(@color); // use yellow #top namespace
     .square(10px);
 }

Upvotes: 2

Related Questions