Skip to content

Multiple Icon Templates #149

Open
Open
@ypnos-web

Description

@ypnos-web

This is a (multiple allowed):

  • bug
  • enhancement
  • question

Since Fontawesome 5 got released, I am faced with the distinction between icon shapes 'solid', 'regular', 'light', and 'brand'. These are selected through a supplemental class 'fas', 'far', 'fab' instead of simply 'fa' (which falls back to solid). While this is mostly a Fontawesome Pro feature, it also affects free users as some regular icons are free to replace the previous '-o' icons, and then there are the brand icons.

To be able to selectively use a specific shape we would need several icon templates, not only a default one. E.g.:

'icon' => [
    '_default' => '<i class="far fa-{{type}}{{attrs.class}}"{{attrs}}></i>',
    's' => '<i class="fas fa-{{type}}{{attrs.class}}"{{attrs}}></i>',
    'b' => '<i class="fab fa-{{type}}{{attrs.class}}"{{attrs}}></i>',

Then we could enhance the magic icon syntax:

i:<iconname> // render icon['_default']
i:s:<iconname> // render icon['s']

Well the first problem with this idea is that templates reside in a flat array so my nesting would not work.
But just for the general idea.

What do you think about it and what design considerations would you have?
I would be happy to prepare a pull request for this feature.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions