Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marcw/twig-heroicons
Heroicons <3 Twig
https://github.com/marcw/twig-heroicons
heroicons twig
Last synced: 2 months ago
JSON representation
Heroicons <3 Twig
- Host: GitHub
- URL: https://github.com/marcw/twig-heroicons
- Owner: marcw
- License: mit
- Created: 2021-04-10T12:21:31.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-08-16T08:04:25.000Z (over 3 years ago)
- Last Synced: 2024-10-11T13:12:13.104Z (3 months ago)
- Topics: heroicons, twig
- Language: PHP
- Homepage:
- Size: 105 KB
- Stars: 11
- Watchers: 3
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Twig Heroicons
[![tests](https://github.com/marcw/twig-heroicons/actions/workflows/php.yml/badge.svg)](https://github.com/marcw/twig-heroicons/actions/workflows/php.yml)
This package provides an Heroicons integration for Twig.
## Install
Use composer:
```bash
composer require marcw/twig-heroicons
```### Symfony
You do not need to do anything more to use the extension.
### Twig
If you use Twig directly, register the extension before using it:
```php
addExtension(new HeroiconsExtension());
```## Usage
This extension provides a `heroicon` function that outputs the icon SVG.
```jinja2
{# function signature #}
{{ heroicon(icon, class, style) }}{# the default style is 'solid' #}
{{ heroicon('academic-cap') }}{# use the 'outline' style #}
{{ heroicon('academic-cap', '', 'outline') }}{# Add a custom class to the SVG #}
{{ heroicon('academic-cap', 'text-green-200', 'outline') }}
```## License
This library is MIT licensed.