3

In Dev enviroment it works perfectly, but when I switch to Prod it doesn't do anything. It looks like it doesn't attach the event listeners (when I inspect elements with Chrome, no event listener is detected where they should). Any ideas? I've cleared both caches and maybe it's important to say that I had copied

_assetic:
resource: .
type:     assetic

from routing_dev.yml to routing.yml because if I don't I got the following 500 Internal Server Error:

request.CRITICAL: Twig_Error_Runtime: An exception has been thrown during the rendering of a template ("Route "_assetic_f582f37" does not exist.")
3
  • Just stumbled across this same issue myself, just wondering if you found a real solution? Commented Sep 22, 2014 at 18:28
  • That moment I've just moved the files from the bundles folders to the web/js folder, I think it had to do with that Symfony version, because I never had the same problem on other developments. Commented Sep 22, 2014 at 21:40
  • I've just found my issue. I didn't have closing </script> tags on the JS that wasn't working. Which was fine in Dev mode but not in Prod mode. Strange but all fixed now. Thank you for the reply. Commented Sep 22, 2014 at 22:19

1 Answer 1

4

Have you dumped your asset files?

php app/console assetic:dump --env=prod --no-debug

http://symfony.com/doc/current/cookbook/assetic/asset_management.html#cookbook-assetic-dumping

Sign up to request clarification or add additional context in comments.

4 Comments

Yes, tried that way, but the same result. Anyway, if I don't dump them I can still access the CSSs and JSs if I go to "View page source", so I don't think the issue follows that way. CSS works fine on both environments, it's just JS that don't seems to work on Prod, but have no idea of what can be causing this. It's like the app is skipping <script> tags and .js files, because they're there, but it's like they we're never read and processed.
Another thing that can be useful: When I dumped the files, it created the physical .js files but it didn't for the .css files.
I've had a similar problem (using Windows which I think matters). cache:clear will create two folders "prod" and "prod_new". Prod folder is missing some things. Then assetic:dump also doesn't dump all files. I can't figure out why so I guess that's no help, just thought the above command might be of use. Are you clearing your cache with --no-debug? I've had mixed results with and without that switch.
Very strange issue, I've moved all the bundles js files to web/js, kept those folders empty and now it works. It's a little messier but at least works well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.