Lajdák Marek Lajdák Marek - 4 years ago 306
Twig Question

Symfony assetic - is possible in dev load original files?

I have project on Symfony 3 with installed assetic. I am using it for merging all css together and minify.

Usage in twig template:

{% stylesheets filter='cssrewrite' filter='uglifycss'
<link rel="stylesheet" href="{{ asset_url }}">
{% endstylesheets %}


cssrewrite: ~
bin: "%kernel.root_dir%/Resources/node_modules/uglify-js/bin/uglifyjs"
bin: "%kernel.root_dir%/Resources/node_modules/uglifycss/uglifycss"

In prod mode all works as expected. Assetic loads css files from path
and generated minified file (css or js) is in default assetic path

But in develop mode assetic generate new files from
(each file and not minified) and load css files from there.


How i can load original files from
in dev mode?

Because in this situation i must after each change in any css or js run
php bin/console assetic:dump --env=dev
and it is unacceptable.

Answer Source

Since you don't want to run php bin/console assetic:dump each time you change a CSS or a JS file, use php bin/console assetic:watch instead, it will automatically regenerate the files on every change of CSS or JS.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download