Use HTTP2 preload for always used CSS and JS files.

This commit is contained in:
Jan Böhmer 2019-11-30 16:46:03 +01:00
parent 5782ef70fb
commit 6882f91ef2
3 changed files with 14 additions and 10 deletions

View file

@ -11,6 +11,7 @@
"ext-json": "*", "ext-json": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
"doctrine/annotations": "^1.6", "doctrine/annotations": "^1.6",
"doctrine/doctrine-bundle": "^1.12",
"florianv/swap": "^4.0", "florianv/swap": "^4.0",
"friendsofsymfony/ckeditor-bundle": "^2.0", "friendsofsymfony/ckeditor-bundle": "^2.0",
"gregwar/captcha-bundle": "dev-master", "gregwar/captcha-bundle": "dev-master",
@ -51,8 +52,7 @@
"twig/extra-bundle": "^3.0", "twig/extra-bundle": "^3.0",
"twig/inky-extra": "^3.0", "twig/inky-extra": "^3.0",
"twig/intl-extra": "^3.0", "twig/intl-extra": "^3.0",
"webmozart/assert": "^1.4", "webmozart/assert": "^1.4"
"doctrine/doctrine-bundle": "^1.12"
}, },
"require-dev": { "require-dev": {
"dama/doctrine-test-bundle": "^5.0", "dama/doctrine-test-bundle": "^5.0",

2
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "5b16a7920092123e0428568b1a22b433", "content-hash": "9660d2f97bab13484c770ab738af0e6c",
"packages": [ "packages": [
{ {
"name": "clue/stream-filter", "name": "clue/stream-filter",

View file

@ -4,7 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="manifest" href="{{ asset('manifest.json') }}"> <link rel="manifest" href="{{ preload(asset('manifest.json'), {as: 'manifest'}) }}">
<meta name="mobile-web-app-capable" content="yes"> <meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
@ -37,14 +37,17 @@
{% set theme = app.user.theme %} {% set theme = app.user.theme %}
{% endif %} {% endif %}
{% if theme %} {% if theme %}
<link rel="stylesheet" href="{{ asset('build/themes/' ~ theme ~ '.css') }}"> <link rel="stylesheet" href="{{ preload(asset('build/themes/' ~ theme ~ '.css'), {as: 'style'}) }}">
{% else %} {% else %}
<link rel="stylesheet" href="{{ asset('build/themes/bootstrap.css') }}"> <link rel="stylesheet" href="{{ preload(asset('build/themes/bootstrap.css'), {as: 'style'}) }}">
{% endif %} {% endif %}
{{ encore_entry_link_tags('app') }} {% for css in encore_entry_css_files('app') %}
<link rel="stylesheet" href="{{ preload(asset(css), {as: 'style'}) }}">
{% endfor %}
{% endblock %} {% endblock %}
</head> </head>
@ -116,8 +119,9 @@
{% endblock %} {% endblock %}
{% block javascripts %} {% block javascripts %}
{{ encore_entry_script_tags('app') }} {% for js in encore_entry_js_files('app') %}
<script src="{{ preload(asset(js), {as: 'script'}) }}"></script>
{% endfor %}
{% endblock %} {% endblock %}