You can set JS global variables on your actual page:
<script> var menuDownUrl = "{{ asset('bundles/mybundle/images/menu_down.png') }}"; </script>
And then set inside your javascript file to call the global variable: window.menuDownUrl
It then creates a dependency inside your javascript file, but allows you to dynamically set this image.
source share