cecil/theme-fontawesome

Cecil 组件主题 Font Awesome

资助包维护!
ArnaudLigny
Open Collective

安装: 253

依赖: 1

建议: 0

安全: 0

星标: 0

关注者: 1

分支: 0

开放问题: 0

语言:Twig

类型:cecil-theme

1.2.0 2024-02-05 23:50 UTC

This package is auto-updated.

Last update: 2024-08-30 23:14:52 UTC


README

Cecil 组件主题 Font Awesome 为 Cecil 提供了使用 Font Awesome 图标 的辅助工具。

安装

composer require cecil/theme-fontawesome

或者 下载最新存档 并在 themes/fontawesome 中解压缩其内容。

用法

config.ymltheme 部分添加 fontawesome

theme:
  - fontawesome

在模板中导入宏

{% import 'macros/fontawesome.twig' as fontawesome %}

然后在模板的 <head> 中包含样式和网页字体

{{ include('partials/fontawesome.twig') }}

显示所需的图标

{{ fontawesome.icon('<name>', '<style>', '<size>', '<attributes>') }}
  • <name>: 图标 名称
  • <style>: 样式 ("regular", "solid" 或 "brands", 默认为 "regular")
  • <size>: 字体 大小 (可选)
  • <attributes>: 额外的 HTML 属性 (可选)

示例

{{ fontawesome.icon('github', 'brands', 'xl', {style: 'color: #333'}) ~}}
<i class="fa-github fa-brands fa-xl" style="color: #333">