CSS URLs
Used by the css()
helper
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