public function testCacheSpeed() { $less = new Less(); $less->compile('tests/resources/simple.less'); // Cache file before tests runBench(['Cache' => function () use($less) { $less->compile('tests/resources/simple.less'); }], ['cache' => 1000]); }
/** * {@inheritdoc} */ public function load(array $filters = []) { $result = parent::load($filters); $compiled = null; if ($result[1]) { $options = $this->_manager->getParams(); $root = $this->_manager->getPath()->getRoot(); $less = new Less($options->get('less')); $compiled = $less->compile($result[1], $root); } return [Asset::TYPE_CSS_FILE, $compiled]; }
public function testCustomFunction() { $less = new Less(['driver' => $this->_driver, 'functions' => ['str-revert' => function ($arg) { $arg->value = strrev($arg->value); return $arg; }]]); $actual = $less->compile('tests/resources/function.less'); $expected = PROJECT_ROOT . '/tests/expected-' . $this->_expectedPath . '/function.css'; $this->_isFileEq($expected, $actual); }