First, I think you have mistaken assets
for assetic
. Twig function asset
does nothing more than making you assets absolute. It does not affect where those assets are read from. That is described in this docs:
On the other hand, assetic
describes where compiled (and optionally filtered, merged, uglified, etc...) resources are read from. That only applies to JS
and CSS
.
Possible solution:
Open Terminal, navigate to your web
symlink that directory:
cd /.../sf2/web
ln -s ../sites/sf2.local/assets/img
ln -s ../sites/sf2.local/assets/js
ln -s ../sites/sf2.local/assets/css
Now you have 3 additional symlinks (not copies) in your web and using asset('img/some-pic.png')
actually targets the symlinked img
directory.
Is this symlinking acceptable?
Alternative solution (whole assets):
cd /.../sf2/web
ln -s ../sites/sf2.local/assets
and use it:
asset('assets/img/some-pic.png')