Skip to content

Commit

Permalink
Simplified asset linking in the layout template
Browse files Browse the repository at this point in the history
Twig's asset() function already does all this and the change
saves us 8 lines of code.
  • Loading branch information
javiereguiluz committed Jan 17, 2015
1 parent 597226c commit d1194f9
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions Resources/views/layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@
<link href="{{ asset('bundles/easyadmin/stylesheet/font-awesome.min.css') }}" rel="stylesheet">
<link href="{{ asset('bundles/easyadmin/stylesheet/admin.css') }}" rel="stylesheet">
{% for css_asset in config.assets.css %}
{% if css_asset starts with '//' or css_asset starts with 'http://' or css_asset starts with 'https://' %}
<link rel="stylesheet" href="{{ css_asset }}">
{% else %}
<link rel="stylesheet" href="{{ asset(css_asset) }}">
{% endif %}
<link rel="stylesheet" href="{{ asset(css_asset) }}">
{% endfor %}
{% block head_stylesheets %}{% endblock %}

Expand Down Expand Up @@ -92,11 +88,7 @@
</div>

{% for js_asset in config.assets.js %}
{% if js_asset starts with '//' or js_asset starts with 'http://' or js_asset starts with 'https://' %}
<script src="{{ js_asset }}"></script>
{% else %}
<script src="{{ asset(js_asset) }}"></script>
{% endif %}
<script src="{{ asset(js_asset) }}"></script>
{% endfor %}
{% block body_javascript %}{% endblock %}

This comment has been minimized.

Copy link
@nicolaskern

nicolaskern Jan 19, 2015

Contributor

I think it would be nice to load custom assets after rendering body_javascript which calls jQuery, in case we create custom jQuery scripts

</body>
Expand Down

0 comments on commit d1194f9

Please sign in to comment.