Steven Dobbelaere
Steven Dobbelaere

Reputation: 211

How to watch assets and automatically install and dump assets with assetic in Symfony

I put all my assets in my Bundles e.g. myBundle/Resources/public/css/

and load them in like so:

{% block stylesheets %}
{{ parent() }}
{% stylesheets
'@myBundle/Resources/public/vendor/bootstrap.css'
filter='cssrewrite'
%}
<link href="{{ asset_url }}" rel="stylesheet" media="screen" />
{% endstylesheets %}
{% endblock %}

So everytime I make an adjustment to my css or js, I need to do a assets:install and then an assetic:dump afterwards to see it in the frontend.

Is there any way to watch the assets in the bundle itself?

Upvotes: 2

Views: 7792

Answers (1)

Tomasz Madeyski
Tomasz Madeyski

Reputation: 10900

You can use symlink option to assets:install command. This will make symlink in web folder to your bundle public folders

app/console assets:install --symlink

Without symlink option this task makes copy of files, so your changes doesn't affect.

You might also want to check watch option to assetic:dump command

app/console assetic:dump --watch

Upvotes: 11

Related Questions