定制 spaze/svg-icons-latte 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

spaze/svg-icons-latte

最新稳定版本:v1.1.0

Composer 安装命令:

composer require spaze/svg-icons-latte

包简介

SVG Icons Custom Tag for Latte Templating System

README 文档

README

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.:

extensions:
	svgIcons: Spaze\SvgIcons\NetteExtension

This will also auto-register the Latte extension itself.

Configuration

svgIcons:
	iconsDir: '../../node_modules/humbleicons/icons'
	cssClass: 'humbleicons'
  • iconsDir is a path to a directory with SVG icon files, for example Humbleicons by @Zraly (required)
  • cssClass defines a CSS class that will be added to the root <svg> element (optional)

Usage in Latte

{icon wifi} will be replaced with the 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 <svg> element.

Given the configuration above, the resulting tag would look like <svg class="humbleicons foo bar" ...>.

Usage in PHP

Use Spaze\SvgIcons\SvgIcons::getSvg(string $icon): string to get the icon SVG in PHP, if you for example want to embed the SVG in an email message where Latte is not available. Pass the icon name without the .svg extension as the $icon parameter, for example wifi, not wifi.svg.

The SvgIcons class uses the directory set in configuration and appends .svg to load the file contents.

统计信息

  • 总下载量: 18
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-10-25