Assets are not shown in dev environment

109 views Asked by At

I have this in the HEAD block:

    {% stylesheets filter='yui_css' output='css/base.css'
            '@MutualContratosBundle/Resources/public/css/ui/south-street/jquery-ui.css'
            '@MutualContratosBundle/Resources/public/css/base.css'
             filter='cssrewrite' %}
    <link rel="stylesheet" href="{{ asset_url }}" />
    {% endstylesheets %}         

    {% block stylesheets %}{% endblock %}

    {% javascripts filter='yui_js' output='js/base.js'
            '@MutualContratosBundle/Resources/public/js/jquery-1.10.2.js'
            '@MutualContratosBundle/Resources/public/js/ui/jquery.ui.core.js'
            '@MutualContratosBundle/Resources/public/js/ui/jquery.ui.widget.js'
            '@MutualContratosBundle/Resources/public/js/ui/jquery.ui.menu.js' %}
    <script type="text/javascript" src="{{ asset_url }}"></script>
    {% endjavascripts %}       

when I load app_dev.php page, all assets are not shown. when I see in firebug, this kind of assets are being trying to load:

http://server/app_dev.php/css/base_jquery-ui_1.css

in prod environment there is no problem. When I deployed and published assets, this CSS was copied into web/css folder :

http://server/app_dev.php/css/base.css

As you see in twig template, I have defined the output parameter. That is why the css has this name.

How can I solve this in dev environment?

This is symfony 2.3.2

1

There are 1 answers

6
lxg On BEST ANSWER

Assets aren’t dumped automatically. You must trigger the generation through the console.

To have them dumped once, run

app/console assetic:dump --force

You can also run a background task which periodically scans your assets for changes and creates new dumps after modifications.

As you are still on SF 2.3, the command for this background task is

app/console assetic:dump --watch --force

Note that SF 2.3 is no longer maintained. You should upgrade to at least SF 2.7 or 2.8 which are the currently maintained long-term support versions.

In newer versions of Assetic, bundled with newer SF versions, the watch command is

app/console assetic:watch --force