oyejorge / less.php

less.js ported to PHP.
http://lessphp.typesettercms.com
Apache License 2.0
657 stars 2 forks source link

Exception thrown when extracting variables with url(...) in them #355

Open torunar opened 6 years ago

torunar commented 6 years ago

Minimal working example:

$less = <<<LESS
    @bg: url(http://via.placeholder.com/350x150);
    .foo {
        background: @bg;
    }
LESS;

    $parser = new \Less_Parser();
    $parser->parse($less);
    $css = $parser->getCss();
    $variables = $parser->getVariables();

Running the following code results in

Exception: type missing in switch/case getVariableValue for Url in /srv/www/cscart.dev/app/lib/vendor/oyejorge/less.php/lib/Less/Parser.php on line 351

CSS, however, is compiled properly:

.foo {
  background: url(http://via.placeholder.com/350x150);
}