css($path, $media = null)

Creates one or multiple CSS link tags

  • $path (string)
    Relative or absolute URL
  • $media (string|array)
    CSS media value or an array of attributes
  • return (string)


Creating a single link tag

<?php echo css('assets/css/site.css') ?>

Creating multiple link tags

<?php echo css(array(
)) ?>

Autoloading template specific css files

<?php echo css('@auto') ?>

Template specific css files must be located in /assets/css/templates and named like the template.

Template CSS file
/site/templates/project.php /assets/css/templates/project.css
/site/templates/home.php /assets/css/templates/home.css
/site/templates/blog.php /assets/css/templates/blog.css

Media attribute

You can also specify a media attribute for the link tags:

<?php echo css('assets/css/print.css', 'print') ?>

2.5.2 +

Other attributes

You can also pass an array of completely custom attributes:

<?php echo css('assets/css/print.css', ['media' => 'print', 'data-something' => 'my-value']) ?>