Twig function to embed svg files as inline svg code into your html code.
Developed by artack in Zurich, Switzerland.
You can install this bundle through Composer:
$ composer require artack/svg-inline-bundle
Register the bundle in your config/bundles.php file.
return [
...
Artack\SvgInlineBundle\SvgInlineBundle::class => ['all' => true],
...
];
Create the configuration file in your config/packages/artack_svg_inline.yaml to define the base path for the svg files.
svg_inline:
path: "%kernel.project_dir%/assets/ci/icon"
Load a svg file as inline svg code into your html code:
# some/template.html.twig
{{ svg_inline('twitter.svg') }}
If you want to add classes to the svg tag you can use the class parameter:
# some/template.html.twig
{{ svg_inline('twitter.svg', class: 'add as many classes as you want') }}
How can I help you explore Laravel packages today?