sun/icon-directive

图标指令提供了 @icon 指令,用于在 blade 模板中使用 fontawesome 图标

v1.0.0 2016-09-01 15:49 UTC

This package is auto-updated.

Last update: 2024-09-08 17:32:30 UTC


README

Build Status Total Downloads Latest Stable Version Latest Unstable Version License

图标指令提供了 @icon 指令,用于在 blade 模板中使用 fontawesome 图标。

安装过程

图标指令可以通过 Composer/Packagist 获得。

composer require sun/icon-directive

将 ServiceProvider 添加到 config/app.php 中的 providers 数组

Sun\IconDirective\IconDirectiveServiceProvider::class,

基本用法

要在 blade 模板中添加 fontawesome 图标,只需使用 @icon 指令并传递 fontawesome 图标名称。

@icon('github')

可选地,您可以给 fontawesome 图标添加额外的类。

@icon('github', 'fa-5x', 'blue')

示例

在 blade 模板中

<button class="btn btn-primary">
    @icon('save') Save
</button>

此代码片段将渲染如下所示

<button class="btn btn-primary">
    <i class="fa fa-save" aria-hidden="true"></i> Save
</button>

许可证

此软件包受MIT 许可证许可。