$page->code()

Returns a $files collection with all code files (css, js, html, etc.) in the page's directory

  • return ($files)

Example

<?php foreach($page->code()->filterBy('extension', 'css') as $css): ?>
<?= css($css->url()) ?>
<?php endforeach ?>

What is a code file?

Kirby considers the following file types as code:

- js
- css
- scss
- rb
- xml
- json
- java

Any html or php files cannot be uploaded to pages for security reasons.