richthegeek / phpsass

A compiler for SASS/SCSS written in PHP, brought up to date (approx 3.2) from a fork of PHamlP: http://code.google.com/p/phamlp/
http://phpsass.com/
382 stars 83 forks source link

@extends in rules of 2 o more levels deep were always ignored #155

Closed gabrielfin closed 10 years ago

gabrielfin commented 10 years ago

In the following example the @extend rule was completely ignored

File a:

@import 'b';

File b:

.foo {
    color: red;
}
.bar {
    .baz {
        @extend .foo;
    }
}

Expected output:

.foo, .bar .baz {
  color: red;
}

Actual output:

.foo {
  color: red;
}

The problem was that when "moving" nodes of "b" to tree "a", the root property was updated only on the first 2 levels. This fix adds a method SassNode::setRoot which changes the root of every node of the subtree being "moved".