How to copy images to web folder with assetic
Asked Answered
H

1

6

I can't believe that I'm not able to google this...

So, I have a symfony2 application, and I installed jQuery UI with Composer. That means i have project structure like this:

/app/
/src/
/vendor/components/jqueryui/
/web/

I have assetic set up to copy js/css files from the vendor folder to web. That works fine. Config:

assetic:
    assets:
        javascripts:
            inputs:
                - %kernel.root_dir%/../vendor/components/jquery/jquery.js
                - %kernel.root_dir%/../vendor/components/jqueryui/ui/jquery-ui.js
                - %kernel.root_dir%/../vendor/components/jqueryui/ui/i18n/jquery.ui.datepicker-cs.js
        stylesheets:
            inputs:
                - %kernel.root_dir%/../vendor/components/jqueryui/themes/redmond/jquery-ui.css
            filters: cssrewrite

After assetic:dump i have

/web/js
/web/css

cssrewrite rewrites images/image.png to ../images/image.png. I guess that's ok, assumes a /web/images directory with said images.

Now the question is: How do I copy the images from /vendor/components/jqueryui/themes/redmond/images to /web/images?

Or is there another best practice to do that? Excuse me if it's and obvious thing, I'm a .NET guy, just trying out PHP.

Hunks answered 13/12, 2013 at 18:58 Comment(1)
Have you found yourself an answer to this? I'm stuck at the same problem.Toein
A
1

My answer probably isn't spot-on because I haven't tried this with vendor files but this is what worked for me:

app/console assets:install

It copies all of your public resources to your web directory.

This answer by user1814739 helped me understand this and may provide additional information for you.

Also consider this advice from the Symfony Blog:

Although developers usually execute the command without any option, most of the time it's better to execute it with the --symlink option. This makes a symbolic link of your assets instead of actually copying their files. This means that any change in the content of the web assets will have immediate effect in the application.

Allodium answered 2/4, 2015 at 13:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.