I have layout.html.twig with:
{% block js %} {% javascripts 'Resources/public/js/jquery/jquery-1.7.1.min.js' 'Resources/public/js/jquery/jquery.namespace.js' %} <script src="{{ asset_url }}" type="text/javascript"></script> {% endjavascripts %} {% endblock %}
And I have index.html.twig with
{% extends "MichaelMikeBundle::layout.html.twig" %} {% block js %} {{ parent() }} {% javascripts '@MichaelStoreBundle/Resources/public/js/index.js' 'Resources/public/js/jqueryui/jquery.ui.core.js' 'Resources/public/js/jqueryui/jquery.ui.widget.js' 'Resources/public/js/jqueryui/jquery.ui.button.js' %} <script src="{{ asset_url }}" type="text/javascript"></script> {% endjavascripts %} {% endblock %}
The first page of the production mode returns two js files (two requests). Symfony2 merges two files from the layout and outputs as one query, and it does the same for the index - it merges 4 files and exits as another request.
My question is: Is it possible to have a layout and index files, as in my example, output all js as a single request? Or at least add javascripts from the index file to the layout ...
Thanks for the help guys!
source share