nerdroid23 / blade-icomoon
一个用于在Laravel Blade视图中轻松使用"IcoMoon"的包。
1.1.0
2023-06-28 12:35 UTC
Requires
- php: ^7.4|^8.0
- blade-ui-kit/blade-icons: ^1.5
- illuminate/support: ^8.0|^9.0||^10.0
- spatie/laravel-package-tools: ^1.4.3
Requires (Dev)
- brianium/paratest: ^6.2
- liip/rmt: ^1.6
- nunomaduro/collision: ^5.3
- orchestra/testbench: ^6.0|^7.0|^8.0
- phpunit/phpunit: ^9.3
README
Blade IcoMoon
一个用于在Laravel Blade视图中轻松使用IcoMoon的包。
要查看所有可用的图标,请参阅SVG目录。
要求
- PHP 7.4 或更高版本
- Laravel 8.0 或更高版本
安装
您可以通过composer安装此包
composer require nerdroid23/blade-icomoon
配置
Blade IcoMoon还提供使用Blade Icons功能的能力,如默认类、默认属性等。如果您想配置这些,请发布blade-icomoon.php
配置文件
您可以通过以下方式发布配置文件
php artisan vendor:publish --provider="Nerdroid23\BladeIcomoon\BladeIcomoonServiceProvider" --tag="blade-icomoon-config"
这是已发布配置文件的内容
return [ /* |----------------------------------------------------------------- | Default Prefix |----------------------------------------------------------------- | | This config option allows you to define a default prefix for | your icons. The dash separator will be applied automatically | to every icon name. It's required and needs to be unique. | */ 'prefix' => 'icomoon', /* |----------------------------------------------------------------- | Fallback Icon |----------------------------------------------------------------- | | This config option allows you to define a fallback | icon when an icon in this set cannot be found. | */ 'fallback' => '', /* |----------------------------------------------------------------- | Default Set Classes |----------------------------------------------------------------- | | This config option allows you to define some classes which | will be applied by default to all icons within this set. | */ 'class' => '', /* |----------------------------------------------------------------- | Default Set Attributes |----------------------------------------------------------------- | | This config option allows you to define some attributes which | will be applied by default to all icons within this set. | */ 'attributes' => [ // 'fill' => 'currentColor', // 'width' => 32, // 'height' => 32, ], ];
用法
图标可以作为自闭合的Blade组件使用,这将编译为SVG图标
<x-icomoon-500px />
您也可以向图标组件传递类
<x-icomoon-500px class="w-6 h-6 text-red-500" />
甚至可以使用内联样式
<x-icomoon-500px style="color: red" />
原始SVG图标
如果您想将原始SVG图标作为资产使用,您可以使用以下方式发布它们
php artisan vendor:publish --tag=blade-icomoon-icons --force
然后在视图中使用它们,如下所示
<img src="{{ asset('vendor/blade-icomoon/500px.svg') }}" width="24" height="24"/>
Blade图标
Blade IcoMoon在底层使用Blade Icons。请参阅Blade Icons的README以获取附加功能。
测试
composer test
更新日志
请参阅更新日志以获取有关最近更改的更多信息。
贡献
请参阅贡献指南以获取详细信息。
安全漏洞
请参阅我们的安全策略,了解如何报告安全漏洞。
鸣谢
许可
MIT许可(MIT)。有关更多信息,请参阅许可文件。