yireo/shopware6-webp

Shopware 6 plugin for adding WebP support

Installs: 1 049

Dependents: 0

Suggesters: 0

Security: 0

Stars: 9

Watchers: 2

Forks: 2

Open Issues: 0

Type:shopware-platform-plugin

dev-master 2022-12-13 07:50 UTC

This package is auto-updated.

Last update: 2024-12-13 12:19:31 UTC


README

This extension adds a Twig filter webp for usage in your Twig templates.

Installation

composer require yireo/shopware6-webp
bin/console plugin:refresh
bin/console plugin:install --activate YireoWebp

Usage

File src/Resources/views/storefront/layout/header/logo.html.twig

{% sw_extends '@Storefront/storefront/layout/header/logo.html.twig' %}

{% block layout_header_logo_image_default %}
    {% if shopware.theme['sw-logo-desktop'] %}
        <source srcset="{{ shopware.theme['sw-logo-desktop'] | webp | sw_encode_url }}"
            alt="{{ "header.logoLink"|trans|striptags }}"
            class="img-fluid header-logo-main-img"
            type="image/webp"
        />
    {% endif %}
    {{ parent() }}
{% endblock %}