Ejemplo n.º 1
0
 /**
  * Registers a piece of Less code.
  * @param string $id ID that uniquely identifies this piece of Less code
  * @param string $less the Less code
  * @param string $media media that the CSS code should be applied to. If empty, it means all media types.
  * @return CClientScript the CClientScript object itself (to support method chaining, available since version 1.1.5).
  */
 public function registerLess($id, $less, $media = '')
 {
     $this->jLessOptions['type'] = 'string';
     $this->jLessOptions['string'] = $less;
     $this->jLessOptions = CMap::mergeArray($this->_jLessOptions, $this->jLessOptions);
     $classa = "JLess\\vendors\\" . $this->jLessOptions[$this->jLessOptions['vendor']]['class'];
     $compiler = new $classa($this->jLessOptions);
     $compiler->compileString();
     return parent::registerCss($id, $compiler->getCss(), $media);
 }
Ejemplo n.º 2
0
 public function registerCss($id, $css, $media = '')
 {
     if ($this->optimizeInlineCss) {
         $css = $this->optimizeCssCode($css);
     }
     return parent::registerCss($id, $css, $media);
 }
Ejemplo n.º 3
0
 /**
  * @param string $id
  * @param string $css
  * @param string $media
  * @param array $options
  * @return YdClientScript
  */
 public function registerCss($id, $css, $media = '', $options = array())
 {
     $options = array_merge(array('order' => 0), $options);
     $this->cssOrder[$id] = $options['order'];
     return parent::registerCss($id, $css, $media);
 }
 public function registerLess($id, $less, $media = '')
 {
     $lessCompiler = new lessc();
     $css = $lessCompiler->compile($less, $id);
     return parent::registerCss($id, $css, $media);
 }
Ejemplo n.º 5
0
 /**
  * @dataProvider providerRegisterCss
  * 
  * @param string $id
  * @param string $css
  * @param string $media
  * @param array $assertion 
  */
 public function testRegisterCss($id, $css, $media, $assertion)
 {
     $returnedClientScript = $this->_clientScript->registerCss($id, $css, $media);
     $this->assertAttributeEquals($assertion, 'css', $returnedClientScript);
 }
Ejemplo n.º 6
0
 public function registerCss($id, $css, $media = '', $order = 0)
 {
     $order = CPropertyValue::ensureInteger($order);
     if ($order) {
         $this->orderCss[$id] = $order;
     }
     return parent::registerCss($id, $css, $media);
 }
Ejemplo n.º 7
0
 /**
  *
  * @param string $id
  * @param string $css
  * @param string $media
  */
 public function registerCss($id, $css, $media = '')
 {
     if (YII_DEBUG === true) {
         $content = $css;
     } else {
         $content = CssCompressor::deflate($css);
     }
     return parent::registerCss($id, $content, $media);
 }