Skip to content

Kirby 3.5.7.1

CSS URLs

Used by the css() helper

/site/plugins/css-helper/index.php
Kirby::plugin('my/css', [
   'components' => [
      'css' => function (App $kirby, string $url, $options = null): string {
          $relative_url = Url::path($url, false);
          $file_root = $kirby->root('index') . DS . $relative_url;

          if (F::exists($file_root)) {
              return url($relative_url . '?' . F::modified($file_root));
          }

          return $url;
      }
  ]
]);

Parameters

Name Type Default Description
$kirby * Kirby\Cms\App Kirby instance
$url * string Relative or absolute URL
$options string|array null An array of attributes for the link tag or a media attribute string

Return type

string