phpsymfonyassetic

Symfony2 and Assetic - cssrewrite works perfectly for dev, not for prod


I include my CSS with the following code:

{% stylesheets 'bundles/majorproductionssewingdivasite/css/*.css' filter='cssrewrite' %}
    <link rel="stylesheet" type="text/css" href="{{ asset_url }}" />
{% endstylesheets %}

In dev, this allows me to use image sprites without any problems. The resulting URL to my sprite is:

http://localhost/diva/web/bundles/majorproductionssewingdivasite/images/diva-sprites.jpg

But, in prod, it gets mapped to:

http://localhost/diva/bundles/majorproductionssewingdivasite/images/diva-sprites.jpg

Notice the lack of web directory.

The generated code in the CSS file is as it should be, and all my CSS (both the dev 'chunks' and the finalized prod assetic dump) are at web/css/. Any ideas as to why the prod environment is skipping the web directory?

EDIT: what's weird is that both dev and prod generate the same URL in the CSS itself:

url('../../bundles/majorproductionssewingdivasite/images/diva-sprites.jpg')


Solution

  • Solution is to dump the assets in the prod environment:

    $ app/console assetic:dump --env=prod