Skip to content

Render SVG from <i></i> tags #6

@husseinalhammad

Description

@husseinalhammad

The get_svg() method tasks 2 arguments: a string representing the FA classes and an array of options. This is great and could work for many people. However, I wonder if it is worth adding another method to parse <i></i> tags:

$FA->render('<i class="fa-solid fa-user"></i>');
$FA->render('<i class="fa-duotone fa-camera fa-swap-opacity"></i>');

Or perhaps the same get_svg() function could accept <i></i> tags too?

$FA->get_svg('<i class="fa-solid fa-user"></i>');
$FA->get_svg('<i class="fa-duotone fa-camera fa-swap-opacity"></i>');

The motivation for this would be:

  1. Make it easier to switch to server-rendered SVGs for existing projects that are currently rendering these client-side
  2. Learn one API (the official FA one) instead of two

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions