title: How to apply condition on grandparent from within the child class in Less
body: <pre><code>&lt;div class="grandParent active"&gt; /*active class added dynamically*/
     &lt;div class="parent1"&gt;
      &lt;div class="childOfParent1"&gt;  Some Text  &lt;/div&gt;
     &lt;/div&gt;
     &lt;div class="parent2"&gt;
       &lt;div class="childOfParent2"&gt;  Some Text  &lt;/div&gt;
     &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Using Less how can i apply the child text color depending on grandParent class</p>
  
  <pre><code>.grandParent {
    .parent1 {
      .childOfParent1 {
        color : red;
        .grandParent:not(active) .parent1 .childOfParent1 {
          color : green;
        }
      }
    }
  } 
  </code></pre>
  
  <p>The above is possible using the below code but i do not want to repeat the code</p>
  
  <pre><code>.grandParent {
    .parent1 {
      .childOfParent1 {
        color : red;
      }
    }
    &amp;:not(active) .parent1 .childOfParent1 {
        color : green;
    }
  }
  </code></pre>