s2b/vite-asset-collector

View on GitHub
Documentation/Reference/IconApi.rst

Summary

Maintainability
Test Coverage
:navigation-title: Icon API

..  include:: /Includes.rst.txt

..  _icon-api:

==============
TYPO3 Icon API
==============

The extension includes a custom `SvgIconProvider` for the :ref:`TYPO3 Icon API <t3coreapi:icon>`
which allows you to register SVG icon files generated by Vite. This works both in frontend
and backend context.

To register a new icon, add the following to the `Configuration/Icons.php` file:

..  code-block:: php
    :caption: Configuration/Icons.php

    return [
        'site-logo' => [
            'provider' => \Praetorius\ViteAssetCollector\IconProvider\SvgIconProvider::class,
            'source' => 'assets/Image/Icon/typo3.svg',
            'manifest' => 'path/to/manifest.json', // optional, defaults to defaultManifest
        ],
    ];

Then you can use the :ref:`Icon ViewHelper <core:icon> <t3viewhelper:typo3-core-icon>`
to use the icon in your templates.