phoenix_inline_svg v0.2.1 PhoenixInlineSvg.Helpers
The module that adds the view helpers to fetch and render SVG files into safe HTML.
In order to get best use out of this this module
should be imported in the quoted view
def of the web/web.ex
.
def view do
quote do
import PhoenixInlineSvg.Helpers
end
end
By default SVG files are loaded from:
priv/static/svg/
The directory where SVG files are loaded from can be configured by setting the configuration variable:
config :phoenix_inline_svg, dir: "some/other/dir"
Where some/other/dir
is a directory located in the Phoenix
application directory.
Note: When using Exrm you will need to ensure that the directory
you set is in the outputted lib
directory of your application.
Summary
Functions
Sends the contents of the SVG file name
in the directory
Sends the contents of the SVG file name
in the directory
Functions
Sends the contents of the SVG file name
in the directory.
Returns a safe HTML string with the contents of the SVG file
wrapped in an i
HTML element with classes.
Examples
<%= svg_image(@conn, "home") %>
Will result in output of:
<i class="generic-svgs generic-home-svg">
<svg>...</svg>
</i>
Sends the contents of the SVG file name
in the directory.
Returns a safe HTML string with the contents of the SVG file
wrapped in an i
HTML element with classes.
Examples
<%= svg_image(@conn, "user", "fontawesome") %>
Will result in the output:
<i class="fontawesome-svgs fontawesome-home-svg">
<svg>...</svg>
</i>