url(); } /** * Creates an absolute Url to a template asset if it exists. This is used in the `css()` and `js()` helpers * * @param string $assetPath * @param string $extension * @return string|null */ public static function toTemplateAsset(string $assetPath, string $extension) { $kirby = App::instance(); $page = $kirby->site()->page(); $path = $assetPath . '/' . $page->template() . '.' . $extension; $file = $kirby->root('assets') . '/' . $path; $url = $kirby->url('assets') . '/' . $path; return file_exists($file) === true ? $url : null; } }