public function testAddInline()
 {
     self::$css->addInline('h1{
         font-size:30px
     }');
     $expected = [];
     $expected[] = '<style type="text/css">';
     $expected[] = 'h1{';
     $expected[] = '            font-size:30px';
     $expected[] = '        }';
     $expected[] = '</style>';
     //dd(self::$css->getInline());
     $this->assertEquals(implode(PHP_EOL, $expected), self::$css->getInline());
 }
Exemple #2
0
 /**
  * Включение пакета с учетом правил использования include/exclude
  * @return bool
  */
 function on()
 {
     if ($this->is_used) {
         return true;
     }
     $route = \Route::currentRouteName();
     $exclude = self::maxIs($this->exclude, $route);
     $include = self::maxIs($this->include, $route);
     if ($exclude > $include || true === $exclude) {
         // исключаем
     } else {
         // подключаем
         //сперва подключим на страницу зависимости
         foreach ((array) $this->require as $require => $scopes) {
             Manager::package($require)->on();
         }
         foreach ($this->deferred_scopes as $scope) {
             $this->scope($scope);
         }
         //затем подключим CSS
         foreach ($this->css as $url => $item) {
             $condition = Arr::get($item, 'condition', null);
             $media = Arr::get($item, 'media', null);
             $no_build = (bool) Arr::get($item, 'no_build', false);
             Css::instance()->add($url, $media, $condition, $no_build);
         }
         //затем подключим JS
         foreach ($this->js as $url => $item) {
             $condition = Arr::get($item, 'condition', null);
             $no_build = (bool) Arr::get($item, 'no_build', false);
             Js::instance()->add($url, $condition, $no_build);
         }
     }
     $this->is_used = true;
     return true;
 }
Exemple #3
0
 function laracss()
 {
     return \Larakit\StaticFiles\Css::instance();
 }