承接 xenbyte/font-awesome-svg-twig-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

xenbyte/font-awesome-svg-twig-bundle

最新稳定版本:1.1.0

Composer 安装命令:

composer require xenbyte/font-awesome-svg-twig-bundle

包简介

Symfony bundle to use FontAwesome svg icons as inline svg.

README 文档

README

This bundle enables the support of FontAwesome SVG icons as inline output within twig templates.

Packagist Version Donate

Features

  • accessability: adds aria-hidden="true" role="img" or a title item with aria-labeledby as recommended by Font Awesome
  • supports Font Awesome composer package (contains only free icons) and manually provided icons (including pro icons)
  • no Font Awesome's css and javascript files necessarry (just css for icon size in your own stylesheet)

Installation

To install this package, you can just use composer. Open a command console, enter your project directory and execute:

composer require xenbyte/font-awesome-svg-twig-bundle

If you don't use Symfony Flex, enable the bundle by adding it to the list of registered bundles in the config/bundles.php file of your project:

// config/bundles.php
return [
    // ...
    Xenbyte\FontAwesomeSvgTwigBundle\FontAwesomeSvgTwigBundle::class => ['all' => true],
];

Set up Font Awesome

Option 1: Using the fortawesome/font-awesome package

composer require fortawesome/font-awesome

The composer package contains only the free icons.

Option 2: Provide the font files manually

Copy the files within node_modules/@fortawesome/fontawesome-pro/svgs to e. g. assets/fontawesome.

Configuration

If you need to customize the global bundle configuration, you can create a /config/packages/font_awesome_svg_twig.yaml file with your configuration:

font_awesome_svg_twig:
  icon_folder: assets/fontawesome
  svg_class: fa-icon

Usage examples

{{ fa("home") }}
{{ fa("fas home") }}
{{ fa("home", {style: 'solid') }}
{{ fa("home", {style: 'regular', color: '#330000', size: '2rem', class: 'icon') }}
{{ fa("home", {style: 'duotone', color: '#333', secondaryColor: '#999', 'title': 'Title', data-foo) }}

Default style is "solid". {{ fa("home") }} and {{ fa("home", {style: solid) }} will produce the same output.

As an alternative for adding the styles in the options, you can also add a short prefix for some styles, e.g. {{ fa("fat home") }} for {{ fa("home", {style: thin) }}.

The following prefixes are supported;:

  • fas = solid
  • far = regular
  • fad = duotone
  • fat = thin
  • fal = light
  • fab = brands

It is recommended to add some default css. All icons gets the class fa-icon:

.fa-icon {
  display: inline-block;
  height: 1em;
  overflow: visible;
  vertical-align: -0.125em;
}

Options

  • resource_folder: Folder with the font awesome icons
  • svg_class: Class which is added to the svg element

Limitation

Stacking items is currently not possible with this extension.

统计信息

  • 总下载量: 662
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-12-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固