这是否可以使用带有继承的资产?使用下面的代码我得到这个错误: An exception has been thrown during the rendering of a template (“Unable to generate a URL for the named route “_assetic_41351d9” as such route
An exception has been thrown during the rendering of a template (“Unable to generate a URL for the named route “_assetic_41351d9” as such route does not exist.
我的应用布局:
{# app/Resources/views/layout.html.twig {% block javascripts %} {% javascripts 'assets/js/jquery-2.2.0.min.js' 'assets/js/main.js' output='assets/compiled/app.js' %} <script src="{{ asset_url }}"></script> {% endjavascripts %} {% endblock %}
我的孩子布局:
{% extends "::layout.html.twig" %} ... {% block javascripts %} {{ parent() }} {% javascripts 'assets/js/jquery.owl.min.js' output='assets/compiled/page.js' %} <script src="{{ asset_url }}"></script> {% endjavascripts %} {% endblock %}是的,您可以在Twig中使用继承,并且在您的代码中尝试执行的操作没有任何内在错误.我会尝试完全清除缓存并再次加载页面,并确保您尝试正确加载的所有资产都存在.