cecil / theme-fontawesome
Cecil component theme Font Awesome
Package info
github.com/Cecilapp/theme-fontawesome
Language:Twig
Type:cecil-theme
pkg:composer/cecil/theme-fontawesome
Requires
- cecil/theme-installer: ^1.4|^2.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
The Font Awesome component theme for Cecil provides helpers to use Font Awesome icons.
Installation
composer require cecil/theme-fontawesome
Or download the latest archive and uncompress its content in
themes/fontawesome.
Usage
Add fontawesome in the theme section of the config.yml:
theme: - fontawesome
Include styles and webfonts in the <head> of your template:
{{ include('partials/fontawesome.twig') }}
By default, it includes regular, solid, and brands icons, but you can select only the one(s) you want using the
stylesarray, i.e.:{{ include('partials/fontawesome.twig', {styles: ['brands']}) }}
Then import macro in your template:
{% import 'macros/fontawesome.twig' as fontawesome %}
Display the desired icon:
{{ fontawesome.icon('<name>', '<style>', '<size>', '<rotate>', '<flip>', '<attributes>') }}
<name>: name of the icon<style>: style ("regular", "solid" or "brands". "regular" by default)<size>: font size (optional)<rotate>: rotation in degrees ("90", "180", "270" or any custom angle, i.e. "45" or "-30")<flip>: flipping ("horizontal", "vertical" or "both")<attributes>: additional HTML attributes (optional,aria-hidden="true"by default)
Example
{{ fontawesome.icon(name:'github', style:'brands', size:'xl', attributes:{style: 'color: #333'}) ~}}
<i class="fa-brands fa-github fa-xl" aria-hidden="true" style="color: #333"></i>
Demo
The demo/ folder contains a website showing the macro options and listing all the icons, using the theme under development:
php demo/link.php cecil serve demo
License
Font Awesome component theme is a free software distributed under the terms of the MIT license.
Font Awesome Free is distributed under its own license (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License).