Open cviebrock opened 7 years ago
Follow-up to my own issue: I was able to kinda solve this by editing config/view.php
in my Laravel project to tell it that I have another possible view directory:
'paths' => [
resource_path('views'),
resource_path('assets/svg')
],
However, it still assumes that templates end with "twig" (as defined in config/twigbridge.php
). So it only works if I rename my "logo.svg" file to "logo.twig".
I'd like to avoid this if possible, so my original question still stands.
+1 I'd like to avoid this too if possible
If anyone finds this, the answer is to create your own extension to call file_get_contents
.
Its safer if you don't pass a path to that function from your twig but you do you.
See https://github.com/willpower232/TOTPBTF3/commit/fcf5f66c8c6db52447f797c008eaf571feddf7fe for reference.
I've been researching ways to inline SVGs into my Twig templates. One suggestion was to use Twig's source function, which returns the content of a template without rendering it.
However, in my L5.4 project I have my templates in /resources/views and my SVGs in /resources/assets/svg.
Because (I think) the way TwigBridge sets up the Twig_Loader_Filesystem, it's only looking in the first directory for the argument I pass to
source()
. So I get an error like:Any suggestions on how to configure the loader to look in two different places?