I am making a flex slider module, and it needs to just load some images statically, the only way I was able to get hold of any of the images was when I used a relative path in a background-image: url(relative-path-to-image) in a css file, but I am not interested in loading it through css.
If I try to access it relative from the template, using <img src="relative-path-to-image">
it won't work of course, because the src
tag are being loaded on the client. I have looked a bit at the templating system and I can use a {{ directory }} variable inside of twig, to maybe get the absolute path to the images right. But I just feel like even if I made that work it would still be a disaster implementation.
So my question is, if you need to add a tag and give it a src path-to-image, what is your go-to solution to get that image accessible?