コード例 #1
0
ファイル: JLessCClientScript.php プロジェクト: n3okill/JLess
 /**
  * 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);
 }
コード例 #2
0
ファイル: EClientScript.php プロジェクト: nilojan/yii-cms
 public function registerCss($id, $css, $media = '')
 {
     if ($this->optimizeInlineCss) {
         $css = $this->optimizeCssCode($css);
     }
     return parent::registerCss($id, $css, $media);
 }
コード例 #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);
 }
コード例 #4
0
 public function registerLess($id, $less, $media = '')
 {
     $lessCompiler = new lessc();
     $css = $lessCompiler->compile($less, $id);
     return parent::registerCss($id, $css, $media);
 }
コード例 #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);
 }
コード例 #6
0
ファイル: XClientScript.php プロジェクト: hung5s/yap
 public function registerCss($id, $css, $media = '', $order = 0)
 {
     $order = CPropertyValue::ensureInteger($order);
     if ($order) {
         $this->orderCss[$id] = $order;
     }
     return parent::registerCss($id, $css, $media);
 }
コード例 #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);
 }