Question

I have a Symfony2 project, and I was wondering how to use assetics which are located in the bundle folder in the view. So I searched the web to find a solution, and I found this command :

php app/console assets:install web

And it works fine on my computer. It created a symlink (seen as a shortcut on windows) so I can call my assets just with something like :

asset("bundles/mybundle/folder/file.css")

But everything changed when... I uploaded it.

The symlink became an actual folder with a copy of all the content of the public folder from my bundle. So when I made changes on src/my/bundle/resources/public/folder/file.css, it didn't change web/resources/bundles/mybundle/folder/file.css because it was a copy, and not a shortcut.

How can I keep a symlink ? Is it because I'm on windows and my server is on Linux ?

Was it helpful?

Solution

The symfony2 standard way is to have a copy of all js and css files in your web directory. Think of it as a clean separation between user/client accessed files and strict server side files. You can workaround it, but you shouldn't.

To solve your problem, after each update to your server you have to delete all files in web/resources/bundles (to make sure removed files from your bundle are not present anymore) and rerun

php app/console assets:install web
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top