Warning: This article was written in 2019, the content might be out of date.

Laravel SVG directive

Categories: Laravel

I was working on a site and uses Steve Schoger's Heroicons. The Heroicons are svg based and it works best with SVG using HTML inline.

I wrote a custom blade directive so that I can include the inline SVG easily with blade directive.


When I need to use a Heroicons svg, I just need to call it with

@svg('heroicon-user-plus-sm')

given that the svg file is already copied into public/svg directory.

Next | Previous