Hello!
On my page
I implemented the following code from the cookbook for art directing pagesā¦
<!-- custom css -->
<?php
if($page->uid() !== "projects"){
echo css($page->files()->filterBy('extension', 'css')->pluck('url')) ;
} ?>
which surpisingly (for me) creates a url that leads to the media folder.
in my case:
<link href="https://eriknorden.com/media/pages/animations/2768874d79-1720611268/animations.css" rel="stylesheet">
but it works at least on my end. However the console throughs an error
Failed to load resource: the server responded with a status of 404 ()
https://eriknorden.com/media/pages/animations/2768874d79-1720611268/animations.css.map
Could I simple create a url that points to the directorys css-file ?
The media folder is expected behavior, because by default, Kirby blocks direct access to the content folder and instead copies files to the media folder.
The error message you get in the console refers to a missing css.map file, not the css files themselves.
thank you for the response. It makes sense.
But then, how do I get kirby to provide the .css.map in the expected media folder?
It is in the page folder, but it looks like itās stuck thereā¦
thank you for your patience.
Hm, good question. Is the map file really needed?
oh! apparently not. Thank you for the response! Seems like I was chasing a problem in the wrong place.
BTW, if you donāt need CSS on a per page level, but rather on a per template level, you can use template specific CSS files: css() | Kirby CMS
1 Like