Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 40369dbdb17d6f5037ce3c1da6644160a550d758 1 parent 5606721
@shnhrrsn shnhrrsn authored
Showing with 8 additions and 3 deletions.
  1. +8 −3 lessc.inc.php
View
11 lessc.inc.php
@@ -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 {
Please sign in to comment.
Something went wrong with that request. Please try again.