I'm unsure how I can get something equivalent to: path('public') to work in a Javascript file?
I basically just need the path to the public folder for displaying some images from my JS file.
I'm unsure how I can get something equivalent to: path('public') to work in a Javascript file?
I basically just need the path to the public folder for displaying some images from my JS file.
You could opt to create a variable in JavaScripts global namespace in the head of your document and use PHP to echo out the public path.
<head>
<script>
var public_path = '{{ path('public') }}';
</script>
...
© 2022 - 2024 — McMap. All rights reserved.