Reputation: 4353
Is it possible to mimic "normal" assets using Assetic so that the following:
{% javascripts '@AppBundle/Resources/public/js/*' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
Would become,
<script src="bundles/App/js/1.js"></script>
<script src="bundles/App/js/2.js"></script>
-- if it is a given that 1.js
and 2.js
are in '@AppBundle/Resources/public/js/*'
The latter, instead of what it becomes currently in Assetic's debug mode:
<script src="/dev.php/js/w/aaaaa_1.js"></script>
<script src="/dev.php/js/w/aaaaa_2.js"></script>
Basically, in development, I want to be able to retrieve the assets directly from the webserver, without using,
$ php bin/console assetic:watch
(as it uses a lot of CPU on our shared development server)Upvotes: 0
Views: 32
Reputation: 442
I think you should be able to do this:
{% javascripts 'bundles/app/js/*' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
And use the command assets:install --symlink
in the config_dev.yml
assetic:
use_controller: false
However using the @ notation resolves caching issues when you deploy since the name will be different when the content changes causing browsers to be forced to download the new file.
More information in the documentation.
Upvotes: 1