Skip to content

Commit

Permalink
Configure asset packages and add package to asset call
Browse files Browse the repository at this point in the history
  • Loading branch information
Danny van Wijk committed Oct 2, 2020
1 parent 85575de commit 75e19c2
Show file tree
Hide file tree
Showing 33 changed files with 104 additions and 93 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<link rel="stylesheet" href="{{ asset('bundles/kunstmaanadmin/default-theme/ckeditor/plugins/notification/css/notification.css') }}">
<link rel="stylesheet" href="{{ asset('bundles/kunstmaanadmin/default-theme/ckeditor/plugins/wordcount/css/wordcount.css') }}">
<link rel="stylesheet" href="{{ asset('bundles/kunstmaanadmin/css/style.css') }}">
<link rel="stylesheet" href="{{ asset('bundles/kunstmaanadmin/default-theme/ckeditor/plugins/notification/css/notification.css', 'asset') }}">
<link rel="stylesheet" href="{{ asset('bundles/kunstmaanadmin/default-theme/ckeditor/plugins/wordcount/css/wordcount.css', 'asset') }}">
<link rel="stylesheet" href="{{ asset('bundles/kunstmaanadmin/css/style.css', 'asset') }}">

<!-- Customizable Brand Color -->
{% if titlecolor is not defined or titlecolor is empty %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<link rel="shortcut icon" href="{{ asset('favicon.ico') }}">
<link rel="apple-touch-icon" href="{{ asset('apple-touch-icon.png') }}">
<link rel="apple-touch-icon" sizes="72x72" href="{{ asset('apple-touch-icon-72x72.png') }}">
<link rel="apple-touch-icon" sizes="114x114" href="{{ asset('apple-touch-icon-114x114.png') }}">
<link rel="shortcut icon" href="{{ asset('favicon.ico', 'asset') }}">
<link rel="apple-touch-icon" href="{{ asset('apple-touch-icon.png', 'asset') }}">
<link rel="apple-touch-icon" sizes="72x72" href="{{ asset('apple-touch-icon-72x72.png', 'asset') }}">
<link rel="apple-touch-icon" sizes="114x114" href="{{ asset('apple-touch-icon-114x114.png', 'asset') }}">
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
{% include "@KunstmaanAdmin/Default/_ckeditor_configs.html.twig" %}

<script>
CKEDITOR_BASEPATH = '/bundles/kunstmaanadmin/default-theme/ckeditor/';
CKEDITOR_BASEPATH = '{{ asset('/bundles/kunstmaanadmin/default-theme/ckeditor/', 'asset') }}';
MORE_BUTTON_LABEL = '{{ 'kuma_js.auto_collapse.more_button_label' | trans | e('js') }}';
</script>

{# Dynamically load the scripts, and only add the Polyfills when they are necessary #}
<script>
{# scripts without polyfills #}
var scripts = [
'{{ asset('bundles/kunstmaanadmin/js/admin-bundle.min.js') }}',
'{{ asset('bundles/kunstmaanadmin/js/admin-bundle.next.js') }}',
'{{ asset('bundles/kunstmaanadmin/js/admin-bundle.min.js', 'asset') }}',
'{{ asset('bundles/kunstmaanadmin/js/admin-bundle.next.js', 'asset') }}',
{%- block extra_async_javascripts %}{% endblock -%}
{%- set jsPath = 'frontend/js/admin-bundle-extra.js' -%}
{% if file_exists(jsPath) %}'{{ asset('/' ~ jsPath) }}'{% endif %}
{% if file_exists(jsPath) %}'{{ asset('/' ~ jsPath, 'asset') }}'{% endif %}
];
if (!('fetch' in window &&
'Promise' in window &&
'assign' in Object &&
'keys' in Object
)) {
scripts.unshift('{{ asset('bundles/kunstmaanadmin/js/admin-bundle-polyfills.js') }}');
scripts.unshift('{{ asset('bundles/kunstmaanadmin/js/admin-bundle-polyfills.js', 'asset') }}');
}
scripts.forEach(function(src) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<!-- Header - Brand -->
<a class="navbar-brand app__header__brand" href="{{ path('KunstmaanAdminBundle_homepage') }}">
{% if admin_logo is defined %}
<img class="app__header__brand__img" src="{{ asset(admin_logo) }}" alt="{{ websitetitle | trans }}">
<img class="app__header__brand__img" src="{{ asset(admin_logo, 'asset') }}" alt="{{ websitetitle | trans }}">
{% else %}
{{ websitetitle | trans }}
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion src/Kunstmaan/AdminBundle/Resources/views/layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% block body %}
<h2 class="login__title">
{% if admin_logo is defined %}
<img class="app__header__brand__img" src="{{ asset(admin_logo) }}" alt="{{ websitetitle | trans }}">
<img class="app__header__brand__img" src="{{ asset(admin_logo, 'asset') }}" alt="{{ websitetitle | trans }}">
{% else %}
{{ websitetitle | trans }}
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% block header %}{% endblock %}

{% block extracss %}
<link rel="stylesheet" href="{{ asset('bundles/kunstmaandashboard/css/dashboard.css') }}">
<link rel="stylesheet" href="{{ asset('bundles/kunstmaandashboard/css/dashboard.css', 'asset') }}">

{% endblock %}

Expand All @@ -18,7 +18,7 @@
{% embed "@KunstmaanAdmin/Default/_js_footer.html.twig" %}
{% block extra_async_javascripts %}
{{ parent() }}
'{{ asset('bundles/kunstmaandashboard/js/dashboard-bundle.min.js') }}',
'{{ asset('bundles/kunstmaandashboard/js/dashboard-bundle.min.js', 'asset') }}',
{% endblock %}
{% endembed %}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% endblock %}

{% block extracss %}
<link rel="stylesheet" href="{{ asset('bundles/kunstmaandashboard/css/dashboard.css') }}">
<link rel="stylesheet" href="{{ asset('bundles/kunstmaandashboard/css/dashboard.css', 'asset') }}">
{% endblock %}

{% block content %}
Expand All @@ -30,7 +30,7 @@
{% embed "@KunstmaanAdmin/Default/_js_footer.html.twig" %}
{% block extra_async_javascripts %}
{{ parent() }}
'{{ asset('bundles/kunstmaandashboard/js/dashboard-bundle-setup.min.js') }}',
'{{ asset('bundles/kunstmaandashboard/js/dashboard-bundle-setup.min.js', 'asset') }}',
{% endblock %}
{% endembed %}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="submenu__item">
<a href="{{ path('_slug', { 'url': item['nt'].url }) }}" class="submenu__link">
{% if item['page'].menuImage is defined and item['page'].menuImage is not empty %}
<img src="{{ item['page'].menuImage.url|imagine_filter('optim') }}" alt="" class="submenu__img">
<img src="{{ asset(item['page'].menuImage.url|imagine_filter('optim'), 'media') }}" alt="" class="submenu__img">
{% endif %}
<h2 class="submenu__title">{{ item['nt'].title }}</h2>
{% if item['page'].menuDescription is defined and item['page'].menuDescription %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<figure class="header-visual">
{% if resource.backgroundImage is not empty %}
<img src="{{ asset(resource.backgroundImage.url|imagine_filter('optim')) }}" class="header-visual__img">
<img src="{{ asset(resource.backgroundImage.url|imagine_filter('optim'), 'media') }}" class="header-visual__img">
{% endif %}

<figcaption class="header-visual__content">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<figure class="col-sm-6 service-pp__image">
{% if resource.image is not empty %}
<img src="{{ asset(resource.image.url|imagine_filter('optimpng')) }}" alt="{{ resource.title }}">
<img src="{{ asset(resource.image.url|imagine_filter('optimpng'), 'media') }}" alt="{{ resource.title }}">
{% endif %}
</figure>
</div>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{% block css %}
<link rel="stylesheet" href="{{ asset('/frontend/css/style.css') }}" type="text/css" />
<link rel="stylesheet" href="{{ asset('/frontend/css/style.css', 'asset') }}" type="text/css" />
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<link rel="shortcut icon" href="{{ asset('favicon.ico') }}" type="image/x-icon">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="{{ asset('apple-touch-icon-152x152-precomposed.png') }}">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="{{ asset('apple-touch-icon-144x144-precomposed.png') }}">
<link rel="apple-touch-icon-precomposed" sizes="120x120" href="{{ asset('apple-touch-icon-120x120-precomposed.png') }}">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="{{ asset('apple-touch-icon-114x114-precomposed.png') }}">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="{{ asset('apple-touch-icon-72x72-precomposed.png') }}">
<link rel="apple-touch-icon-precomposed" href="{{ asset('apple-touch-icon-precomposed.png') }}">
<link rel="shortcut icon" href="{{ asset('favicon.ico', 'asset') }}" type="image/x-icon">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="{{ asset('apple-touch-icon-152x152-precomposed.png', 'asset') }}">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="{{ asset('apple-touch-icon-144x144-precomposed.png', 'asset') }}">
<link rel="apple-touch-icon-precomposed" sizes="120x120" href="{{ asset('apple-touch-icon-120x120-precomposed.png', 'asset') }}">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="{{ asset('apple-touch-icon-114x114-precomposed.png', 'asset') }}">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="{{ asset('apple-touch-icon-72x72-precomposed.png', 'asset') }}">
<link rel="apple-touch-icon-precomposed" href="{{ asset('apple-touch-icon-precomposed.png', 'asset') }}">

<link rel="apple-touch-icon" sizes="57x57" href="{{ asset('apple-touch-icon-57x57.png') }}">
<link rel="apple-touch-icon" sizes="60x60" href="{{ asset('apple-touch-icon-60x60.png') }}">
<link rel="apple-touch-icon" sizes="72x72" href="{{ asset('apple-touch-icon-72x72.png') }}">
<link rel="apple-touch-icon" sizes="76x76" href="{{ asset('apple-touch-icon-76x76.png') }}">
<link rel="apple-touch-icon" sizes="114x114" href="{{ asset('apple-touch-icon-114x114.png') }}">
<link rel="apple-touch-icon" sizes="120x120" href="{{ asset('apple-touch-icon-120x120.png') }}">
<link rel="apple-touch-icon" sizes="144x144" href="{{ asset('apple-touch-icon-144x144.png') }}">
<link rel="apple-touch-icon" sizes="152x152" href="{{ asset('apple-touch-icon-152x152.png') }}">
<link rel="apple-touch-icon" sizes="180x180" href="{{ asset('apple-touch-icon-180x180.png') }}">
<link rel="icon" type="image/png" href="{{ asset('favicon-32x32.png') }}" sizes="32x32">
<link rel="icon" type="image/png" href="{{ asset('android-chrome-192x192.png') }}" sizes="192x192">
<link rel="icon" type="image/png" href="{{ asset('favicon-96x96.png') }}" sizes="96x96">
<link rel="icon" type="image/png" href="{{ asset('favicon-16x16.png') }}" sizes="16x16">
<link rel="manifest" href="{{ asset('manifest.json') }}">
<link rel="mask-icon" href="{{ asset('safari-pinned-tab.svg') }}" color="#5bbad5">
<link rel="apple-touch-icon" sizes="57x57" href="{{ asset('apple-touch-icon-57x57.png', 'asset') }}">
<link rel="apple-touch-icon" sizes="60x60" href="{{ asset('apple-touch-icon-60x60.png', 'asset') }}">
<link rel="apple-touch-icon" sizes="72x72" href="{{ asset('apple-touch-icon-72x72.png', 'asset') }}">
<link rel="apple-touch-icon" sizes="76x76" href="{{ asset('apple-touch-icon-76x76.png', 'asset') }}">
<link rel="apple-touch-icon" sizes="114x114" href="{{ asset('apple-touch-icon-114x114.png', 'asset') }}">
<link rel="apple-touch-icon" sizes="120x120" href="{{ asset('apple-touch-icon-120x120.png', 'asset') }}">
<link rel="apple-touch-icon" sizes="144x144" href="{{ asset('apple-touch-icon-144x144.png', 'asset') }}">
<link rel="apple-touch-icon" sizes="152x152" href="{{ asset('apple-touch-icon-152x152.png', 'asset') }}">
<link rel="apple-touch-icon" sizes="180x180" href="{{ asset('apple-touch-icon-180x180.png', 'asset') }}">
<link rel="icon" type="image/png" href="{{ asset('favicon-32x32.png', 'asset') }}" sizes="32x32">
<link rel="icon" type="image/png" href="{{ asset('android-chrome-192x192.png', 'asset') }}" sizes="192x192">
<link rel="icon" type="image/png" href="{{ asset('favicon-96x96.png', 'asset') }}" sizes="96x96">
<link rel="icon" type="image/png" href="{{ asset('favicon-16x16.png', 'asset') }}" sizes="16x16">
<link rel="manifest" href="{{ asset('manifest.json', 'asset') }}">
<link rel="mask-icon" href="{{ asset('safari-pinned-tab.svg', 'asset') }}" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-TileImage" content="{{ asset('mstile-144x144.png') }}">
<meta name="msapplication-TileImage" content="{{ asset('mstile-144x144.png', 'asset') }}">
<meta name="theme-color" content="#ffffff">
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
{% endif %}
</p>
<p class="sub-footer__credentials">
Created by <a href="http://www.kunstmaan.be" class="sub-footer__credentials__link"><img src="/frontend/img/general/logo-kunstmaan.svg" alt="Kunstmaan" class="sub-footer__credentials__img"></a>
Created by <a href="http://www.kunstmaan.be" class="sub-footer__credentials__link"><img src="{{ asset('/frontend/img/general/logo-kunstmaan.svg', 'asset') }}" alt="Kunstmaan" class="sub-footer__credentials__img"></a>
</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{# Logo #}
{% set homepagePageNode = nodemenu.getRootNodeMenuItem() %}
<a href="{{ path('_slug', { 'url': homepagePageNode.slug }) }}" class="main-header__logo">
<img src="/frontend/img/demosite/logo-thecrew.svg" alt="The Crew" class="main-header__logo__img">
<img src="{{ asset('/frontend/img/demosite/logo-thecrew.svg', 'asset') }}" alt="The Crew" class="main-header__logo__img">
</a>


Expand Down Expand Up @@ -52,7 +52,7 @@
{# Logo #}
{% set homepagePageNode = nodemenu.getNodeByInternalName('homepage') %}
<a href="{{ path('_slug', { 'url': homepagePageNode.slug }) }}" class="main-header__logo">
<img src="/frontend/img/demosite/logo-thecrew.svg" alt="The Crew" class="main-header__logo__img">
<img src="{{ asset('/frontend/img/demosite/logo-thecrew.svg', 'asset') }}" alt="The Crew" class="main-header__logo__img">
</a>


Expand Down Expand Up @@ -121,7 +121,7 @@
{# Logo #}
{% set homepagePageNode = nodemenu.getNodeByInternalName('homepage') %}
<a href="{{ path('_slug', { 'url': homepagePageNode.slug }) }}" class="main-header__logo">
<img src="/frontend/img/general/logo-kunstmaan.svg" alt="Kunstmaan" class="main-header__logo__img">
<img src="{{ asset('/frontend/img/general/logo-kunstmaan.svg', 'asset') }}" alt="Kunstmaan" class="main-header__logo__img">
</a>


Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{% block jsBundle %}
<script src="{{ asset('/frontend/js/bundle.js') }}"></script>
<script src="{{ asset('/frontend/js/bundle.js', 'asset') }}"></script>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% endif %}

<p class="download-pp">
<a href="{{ app.request.schemeandhttphost ~ app.request.basePath ~ asset(resource.media.url) }}" target="_blank" class="download">{{ name }}</a>
<a href="{{ absolute_url(asset(resource.media.url, 'media')) }}" target="_blank" class="download">{{ name }}</a>
<span>| {{ resource.media.contentTypeShort }} {{ resource.media.getFileSize() }}</span>
</p>
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
{% set imgUrl = '' %}

{% if type in ['svg', 'gif'] %}
{% set imgUrl = absolute_url(asset(image)) %}
{% set imgUrl = absolute_url(asset(image, 'media')) %}
<img src="{{ imgUrl }}"{% if altText %} alt="{{ altText }}"{% endif %} />
{% else %}
{% set imgUrl_huge = asset(image | imagine_filter('image_huge_' ~ type)) %}
{% set imgUrl_big = asset(image | imagine_filter('image_big_' ~ type)) %}
{% set imgUrl_medium = asset(image | imagine_filter('image_medium_' ~ type)) %}
{% set imgUrl_small = asset(image | imagine_filter('image_small_' ~ type)) %}
{% set imgUrl_huge = asset(image | imagine_filter('image_huge_' ~ type), 'media') %}
{% set imgUrl_big = asset(image | imagine_filter('image_big_' ~ type), 'media') %}
{% set imgUrl_medium = asset(image | imagine_filter('image_medium_' ~ type), 'media') %}
{% set imgUrl_small = asset(image | imagine_filter('image_small_' ~ type), 'media') %}
{% set srcSet = imgUrl_small ~ ' 400w, ' ~ imgUrl_medium ~ ' 600w, ' ~ imgUrl_big ~ ' 1200w, ' ~ imgUrl_huge ~ ' 2400w' %}

{#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
{% set imgUrl = '' %}

{% if type in ['svg', 'gif'] %}
{% set imgUrl = absolute_url(asset(image)) %}
{% set imgUrl = absolute_url(asset(image, 'media')) %}
<img class="video-pp__link__img" src="{{ imgUrl }}"{% if altText %} alt="{{ altText }}"{% endif %} />
{% else %}
{% set imgUrl_huge = asset(image | imagine_filter('image_huge_' ~ type)) %}
{% set imgUrl_big = asset(image | imagine_filter('image_big_' ~ type)) %}
{% set imgUrl_medium = asset(image | imagine_filter('image_medium_' ~ type)) %}
{% set imgUrl_small = asset(image | imagine_filter('image_small_' ~ type)) %}
{% set imgUrl_huge = asset(image | imagine_filter('image_huge_' ~ type), 'media') %}
{% set imgUrl_big = asset(image | imagine_filter('image_big_' ~ type), 'media') %}
{% set imgUrl_medium = asset(image | imagine_filter('image_medium_' ~ type), 'media') %}
{% set imgUrl_small = asset(image | imagine_filter('image_small_' ~ type), 'media') %}
{% set srcSet = imgUrl_small ~ ' 400w,' ~ imgUrl_medium ~ ' 600w,' ~ imgUrl_big ~ ' 1200w,' ~ imgUrl_huge ~ ' 2400w'%}

<img class="video-pp__link__img" srcset="{{ srcSet }}"{% if altText %} sizes="100vw" alt="{{ altText }}"{% endif %}/>
Expand All @@ -24,10 +24,10 @@

{% if resource.video is defined and resource.video %}
<div class="video-pp">
{% set videoImage = asset('frontend/img/general/video-pp--default.svg') %}
{% set videoImage = asset('frontend/img/general/video-pp--default.svg', 'asset') %}
{% set imageType = 'jpg' %}
{% if resource.thumbnail is not empty %}
{% set videoImage = asset(resource.thumbnail.url|imagine_filter('optim')) %}
{% set videoImage = asset(resource.thumbnail.url|imagine_filter('optim'), 'media') %}
{% set imageType = resource.thumbnail.originalFilename|lower|split('.')|last %}
{% endif %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
{% elseif key == 'link' %}
<a href="{{ "{{ resource." ~ fieldArray['url']['fieldName'] ~ "|replace_url }}" }}" {{ "{% if resource." ~ fieldArray['new_window']['fieldName'] ~ " %}target=\"_blank\"{% endif %}" }}>{{ "{{ resource." ~ fieldArray['text']['fieldName'] ~ " }}" }}</a>
{% elseif key == 'image' %}
{{ "{% if resource." ~ fieldArray['image']['fieldName'] ~ " is not empty %}" }}<img src="{{ "{{ asset(resource." ~ fieldArray['image']['fieldName'] ~ ".url) }}" }}" {{ "{% if resource." ~ fieldArray['alt_text']['fieldName'] ~ " is not empty %}" }}alt="{{ "{{ resource." ~ fieldArray['alt_text']['fieldName'] ~ " }}" }}"{{ "{% endif %}" }} />{{ "{% endif %}" }}
{{ "{% if resource." ~ fieldArray['image']['fieldName'] ~ " is not empty %}" }}<img src="{{ "{{ asset(resource." ~ fieldArray['image']['fieldName'] ~ ".url, 'media') }}" }}" {{ "{% if resource." ~ fieldArray['alt_text']['fieldName'] ~ " is not empty %}" }}alt="{{ "{{ resource." ~ fieldArray['alt_text']['fieldName'] ~ " }}" }}"{{ "{% endif %}" }} />{{ "{% endif %}" }}
{% elseif key == 'media' %}
{{ "{% if resource." ~ fieldArray[0]['fieldName'] ~ " is not empty %}" }}<a href="{{ "{{ asset(resource." ~ fieldArray[0]['fieldName'] ~ ".url) }}" }}">{{ "{{ resource." ~ fieldArray[0]['fieldName'] ~ ".name }}" }}</a>{{ "{% endif %}" }}
{{ "{% if resource." ~ fieldArray[0]['fieldName'] ~ " is not empty %}" }}<a href="{{ "{{ asset(resource." ~ fieldArray[0]['fieldName'] ~ ".url, 'media') }}" }}">{{ "{{ resource." ~ fieldArray[0]['fieldName'] ~ ".name }}" }}</a>{{ "{% endif %}" }}
{% elseif key == 'single_ref' %}
{{ "{% if resource." ~ fieldArray[0]['fieldName'] ~ " is not empty %}" }}<div>{{ fieldArray[0]['targetEntity'] }}: {{ "{{ resource." ~ fieldArray[0]['fieldName'] ~ " }}" }}</div>{{ "{% endif %}" }}
{% elseif key == 'multi_ref' %}
Expand All @@ -30,4 +30,4 @@
<div>{{ "{% if resource." ~ fieldArray[0]['fieldName'] ~ " %}{{ resource." ~ fieldArray[0]['fieldName'] ~ "|date(\"Y-m-d H:i:s\") }}{% endif %}" }}</div>
{% endif %}
{% endfor %}{% endfor %}
</div>
</div>

0 comments on commit 75e19c2

Please sign in to comment.