Permalink
Browse files

Added a prepend selector (^) as a way to push a selector to the front…

… of the tag stack, instead of appending it
  • Loading branch information...
1 parent 5606721 commit 40369dbdb17d6f5037ce3c1da6644160a550d758 @shnhrrsn shnhrrsn committed Jan 28, 2011
Showing with 8 additions and 3 deletions.
  1. +8 −3 lessc.inc.php
View
@@ -48,6 +48,7 @@ class lessc {
public $vPrefix = '@'; // prefix of abstract properties
public $mPrefix = '$'; // prefix of abstract blocks
public $imPrefix = '!'; // special character to add !important
+ public $prependSelector = '^'; // prefix for selectors to prepended
public $selfSelector = '&';
static protected $precedence = array(
@@ -839,9 +840,13 @@ function compileBlock($block, $parentTags = null, $bindEnv = true) {
$tags = array();
foreach ($parentTags as $outerTag) {
foreach ($block['__tags'] as $innerTag) {
- $tags[] = trim($outerTag.
- ($innerTag{0} == $this->selfSelector || $innerTag{0} == ':'
- ? ltrim($innerTag, $this->selfSelector) : ' '.$innerTag));
+ if($innerTag{0} == $this->selfSelector || $innerTag{0} == ':') {
+ $tags[] = trim($outerTag.ltrim($innerTag, $this->selfSelector));
+ } else if($innerTag{0} == $this->prependSelector) {
+ $tags[] = trim(ltrim($innerTag, $this->prependSelector).' '.$outerTag);
+ } else {
+ $tags[] = trim($outerTag.' '.$innerTag);
+ }
}
}
} else {

0 comments on commit 40369db

Please sign in to comment.