cecil / theme-fontawesome
Cecil 组件主题 Font Awesome
资助包维护!
ArnaudLigny
Open Collective
1.2.0
2024-02-05 23:50 UTC
Requires
- cecil/theme-installer: ^1.4|^2.0
README
Cecil 组件主题 Font Awesome 为 Cecil 提供了使用 Font Awesome 图标 的辅助工具。
安装
composer require cecil/theme-fontawesome
或者 下载最新存档 并在
themes/fontawesome
中解压缩其内容。
用法
在 config.yml
的 theme
部分添加 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">