This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Verbat
Verbat

I would like to use twig and source to include my critical css like the below but I always get an exeption which says view not found.

<style>
{{ source('critical.css', ignore_missing = true) }}
</style>

The critical.css is located in my assets folder and i tried set the path at {{ source('path/to/assets/critical.css') }} and also tried to set the path in my config/view.php (to adjust the view folder where twig looks for the file) but I cant bring it to work.

Can someone perhaps point me into the right direction where to place the css file so i can use source or even better let me know where and how to adjust the view location so i can leave the files in my assets folder.

Many thanks

ndcisiv
ndcisiv

May I ask the reason as why you need to use source() for this? Why can't you simply load the partial using the regular old October way? {% partial 'assets/critical.css' %}

Verbat
Verbat

That would be my second option. I would prefer to load it from my assets folder instead of the partial folder just to be consistent with file locations.

g.vanto67453
g.vanto67453

Only .htm files can be loaded with {% partial %} ...

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.