示例#1
0
 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]);
 }
示例#2
0
文件: LessFile.php 项目: jbzoo/assets
 /**
  * {@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];
 }
示例#3
0
 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);
 }