我在config.yml中有以下几行:
assetic:
# ...
assets:
image1:
input: @bundle/Resource/images/image1.png
output: images/image1.png
image2:
input: @bundle/Resource/images/image2.png
output: images/image2.png
如何一次或通过面具复制一些文件?
例如:
assetic:
# ...
assets:
images:
input: @bundle/Resource/images
output: images
或:
assetic:
# ...
assets:
images:
input: @bundle/Resource/images/*.png
output: images/*.png
答案 0 :(得分:1)
为什么要在config.yml
中添加图片?
首选assets:install
命令。它将您的Bundle/Resources/public
目录复制到您的web
目录。因此,将您的图像放在Bundle/Resources/public/images
中,运行命令并在您查看中使用您的资源:
{% image '@Bundle/Resources/public/images/image.png'%}
<img src="{{ asset_url }}" alt="">
{% endimage %}