log1x / blade-filetype-icons

一个Laravel Blade视图中使用dmhendricks/file-icon-vectors的包,方便使用。

v1.0.6 2024-03-15 10:36 UTC

This package is auto-updated.

Last update: 2024-09-15 11:52:39 UTC


README

Social Image

Blade 文件类型图标

Latest Stable Version Total Downloads Build Status

一个包,可以轻松在Laravel Blade视图中使用file-icon-vectors,由Daniel Hendricks创建。

本包专注于file-icon-vectors的vivid和square-o变体,因为它们可以被制作成单色。

有关可用图标的完整列表,请参阅SVG目录原始仓库

要求

  • PHP 8.0或更高版本
  • Laravel 9.0或更高版本

安装

$ composer require log1x/blade-filetype-icons

Blade图标

Blade File Type Icons在底层使用Blade Icons。有关更多功能,请参阅Blade Icons的README。我们还建议使用此库时启用图标缓存

配置

Blade File Type Icons还提供了使用Blade Icons功能的能力,如默认类、默认属性等。如果您想配置这些,发布blade-filetype-icons.php配置文件

php artisan vendor:publish --tag=blade-filetype-icons-config

用法

图标可以作为自闭合的Blade组件使用,将被编译为SVG图标

<x-filetype-v-exe />

您也可以向图标组件传递类

<x-filetype-v-exe class="w-6 h-6 text-gray-500" />

甚至使用内联样式

<x-filetype-v-exe style="color: #555" />

或使用@svg指令

@svg('filetype-v-exe', 'w-6 h-6', ['style' => 'color: #555'])

square-o图标可以如此引用

<x-filetype-s-exe />

原始SVG图标

如果您想将原始SVG图标作为资产使用,可以使用以下方式发布它们

php artisan vendor:publish --tag=blade-filetype-icons --force

然后在视图中使用它们,如下所示

<img src="{{ asset('vendor/blade-filetype-icons/v-exe.svg') }}" width="10" height="10"/>

错误报告

如果您在Blade File Type Icons中发现错误,请打开一个问题

贡献

鼓励并感谢通过PR、报告问题或提出建议进行贡献。

许可证

Blade File Type Icons在MIT许可证下提供。