Skip to content

SVG Helper #7

@rdimascio

Description

@rdimascio

Is your enhancement related to a problem? Please describe.

We end up adding an SVG helper to every project, usually a variation of this template tag, and would benefit from a unified approach added the our theme scaffold.

While this helper function works 90% of the time, I think something to consider is that this approach uses file_get_contents for every icon on the page — which can end up in many calls. It also uses inline SVGs, which can be one of the best approaches in terms of performance, but for sites with large or unoptimized SVGs, it's by far the worst - https://cloudfour.com/thinks/svg-icon-stress-test/#breakdown-by-technique.

It's also important to consider how we're rendering icons in other contexts (JS template tags and the block editor). Ideally, we would have approach that can use the same SVGs in every context, so that we don't repeat ourselves.

Designs

No response

Describe alternatives you've considered

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions