Assembling multiple images in Symfony2

I have the following lines in 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

How to copy multiple files at the same time or by mask?

For example:

assetic:
    # ...
    assets:
        images:
            input: @bundle/Resource/images
            output: images

or

assetic:
    # ...
    assets:
        images:
            input: @bundle/Resource/images/*.png
            output: images/*.png
+4
source share
1 answer

Why are you adding images to yours config.yml?

Prefer a team assets:install. Copy the directory Bundle/Resources/publicto the directory web. So put your images in Bundle/Resources/public/images, run the command and use your assets in your view:

{% image '@Bundle/Resources/public/images/image.png'%}
    <img src="{{ asset_url }}" alt="">
{% endimage %}
+1
source

Source: https://habr.com/ru/post/1526361/


All Articles