Basically, I want to know if something like the following is possible:
<img src="{{ asset('bundles/acme/images' {% if something is defined %}'-blah{{ someId }}'{% endif %} '.png') }}" />
According to this the answer is likely no, but I want to make sure.
Why don't you put the if outside the asset
-call like this:
<img src="
{%- if something is defined -%}
{{ asset('bundles/acme/images-blah' ~ someId ~ '.png') }}
{%- else -%}
{{ asset('bundles/acme/images-blah.png') }}
{%- endif -%}
" />