0

I have added a css file to src/MyApp/MyBundle/Resources/public/css/my.css

Using assetic how do I include it? I've tried {% stylesheets 'bundles/myapp_my/css/*' filter='cssrewrite' %} but it's not coming through.

Is the bundles/myapp_my/css/* format correct?

I've followed http://symfony.com/doc/current/cookbook/assetic/asset_management.html but I'm really not clear on what format (see the line above) I should be using. An underscore separating the app name from the first word of the bundle?

Any help appreciated, thanks.

Edit: the full code I'm using to include it is this:

{% block stylesheets %}
    {% stylesheets 'bundles/myapp_my/css/**' filter='cssrewrite' %}
    <link rel="stylesheet" href="{{ asset_url }}" />
    {% endstylesheets %}
{% endblock %}
b85411
  • 9,420
  • 15
  • 65
  • 119

1 Answers1

2

That is correct, but then afterwards, you have to do app/console assets:install; app/console assetic:dump to use everything in the production environment. If you are using dev, the controller should serve up the files dynamically so you can edit it on the fly.

PressingOnAlways
  • 11,948
  • 6
  • 32
  • 59
  • Ah thanks, `app/console assets:install` was what I needed. But I find I need to run that every time I make a CSS change - even if I run in app_dev.php mode. Is there any way I can get it to pick changes up automatically? – b85411 Apr 17 '14 at 05:59
  • Refer to the answer to this question: http://stackoverflow.com/questions/9931127/symfony-2-working-with-assets. The symlink option should achieve what you are looking for. – PressingOnAlways Apr 17 '14 at 17:01