odan/twig-assets

Twig error

drnasin opened this issue · 2 comments

Hi @odan , I'm trying to use this in my slim4 project but I can't get it to work.

I keep getting

Type: Twig\Error\LoaderError
Code: 0
Message: Unable to find template "cdn/assets/bootstrap.bundle.js" (looked into: C:\Users\antek\PhpstormProjects\kompcontrol/app/templates/shop).

I'm not sure as to why assets look into templates dr?

I use it like this in twig
{{ assets({files: ['cdn/assets/bootstrap.bundle.js']}) }}

But I get that error no matter what I do. I think the code is ok. I'm not sure about the base path setting as I'm not using the "Public dir"

My settings:
image

Here is my dependency code

image

Middleware
image

Not sure what am I doing wrong. Seems ok. All the paths are correct.

Thank you for any help @odan !

got it to work using

$loader->addPath(SHOP_PATH, 'public');

{{ assets({files: ['@public/cdn/assets/bootstrap.bundle.js']}) }}

odan commented

This is good.