예제 #1
0
 protected function setUp()
 {
     $this->createApplication();
     self::$css = \Larakit\StaticFiles\Css::instance();
     self::$css->clearAll();
     Config::set('larakit.lk-staticfiles.version', 'hash');
 }
예제 #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;
 }
예제 #3
0
 function laracss()
 {
     return \Larakit\StaticFiles\Css::instance();
 }