https://github.com/spaze/svg-icons-latte
SVG Icons Custom Tag for Latte Templating System
https://github.com/spaze/svg-icons-latte
Last synced: 2 months ago
JSON representation
SVG Icons Custom Tag for Latte Templating System
- Host: GitHub
- URL: https://github.com/spaze/svg-icons-latte
- Owner: spaze
- License: mit
- Created: 2022-10-24T23:29:14.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-26T00:59:13.000Z (8 months ago)
- Last Synced: 2025-03-23T16:51:21.332Z (3 months ago)
- Language: PHP
- Size: 18.6 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SVG Icons Custom Tag for Latte Templating System
The custom `{icon}` tag will embed an SVG icon loaded from an external file.
## Installation
```
composer require spaze/svg-icons-latte
```
Requires PHP 8.1+Register the Nette extension, e.g.:
```neon
extensions:
svgIcons: Spaze\SvgIcons\NetteExtension
```
This will also auto-register the Latte extension itself.## Configuration
```neon
svgIcons:
iconsDir: '../../node_modules/humbleicons/icons'
cssClass: 'humbleicons'
```
- `iconsDir` is a path to a directory with SVG icon files, for example [Humbleicons](https://humbleicons.com/) by [@Zraly](https://twitter.com/zraly) (required)
- `cssClass` defines a CSS class that will be added to the root `` element (optional)## Usage
`{icon wifi}` will be replaced with a contents loaded from `wifi.svg` located in `iconsDir`.You can also add extra CSS classes:
`{icon wifi class => foo, class => bar}` will add additional CSS classes `foo` and `bar` to the root `` element.Given the configuration above, the resulting tag would look like ``.