K
K
Kir ---2013-04-02 13:10:20
symfony
Kir ---, 2013-04-02 13:10:20

Symfony 2: Assetic - assembly of resources into one file, after passing through templates?

Is it possible to collect all scripts from a template and merge them into one file?
Scripts are connected from templates throughout the project, i.e. this approach, where everything is connected from one place, does not suit us

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
daeto, 2013-04-02
@daeto

I do not know the complete solution of the task, but I solved it with little bloodshed, dividing the scripts into bundles (folders). Accordingly, I achieved a decrease to 3-4, depending on the section. But one common one is always cached, and the rest are pretty fast too. Did something like this:

{% javascripts '@SomeBundle/Resources/js/*' output='js/bundle.combined.js' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}

I would be glad if someone offers a better solution.

J
JekaRu, 2013-04-02
@JekaRu

I once thought about this, but came to the conclusion that you need to collect files only those that are guaranteed to be on all pages at the same time.
Otherwise, we will have a bunch of assemblies that differ internally, for example, only in the contents of one file.
Sorry if I misunderstood the situation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question