brady v0.0.10 Brady
Summary
Functions
Returns the controller name and controller-action name as a lowercase, dasherized string
Encodes an image to base64-encoded data uri, compatible for img src attributes. Only recommended for files less than 2kb. This threshold is configurable with mix config
Embeds an html safe raw SVG in the markup. Also takes an optional list of CSS attributes and applies those to the SVG
Functions
Specs
body_class(%Plug.Conn{adapter: term, assigns: term, before_send: term, body_params: term, cookies: term, halted: term, host: term, method: term, owner: term, params: term, path_info: term, peer: term, port: term, private: term, query_params: term, query_string: term, remote_ip: term, req_cookies: term, req_headers: term, request_path: term, resp_body: term, resp_cookies: term, resp_headers: term, scheme: term, script_name: term, secret_key_base: term, state: term, status: term}) :: String.t
Returns the controller name and controller-action name as a lowercase, dasherized string.
For example, when the conn came from CoolWidgetsController#show:
Brady.body_class(conn) => 'cool-widgets cool-widgets-show'"
Encodes an image to base64-encoded data uri, compatible for img src attributes. Only recommended for files less than 2kb. This threshold is configurable with mix config:
config :brady, inline_threshold: 10_240
Ex:
Brady.data_uri("placeholder.gif")
# => "data:image/gif;base64,iVBORw0KGgoAAAA"
Embeds an html safe raw SVG in the markup. Also takes an optional list of CSS attributes and applies those to the SVG.
Ex:
Brady.inline_svg("test", class: "foo", "data-role": "bar") =>
{:safe,
"<svg class="foo" data-role="bar" height="100" width="100"><desc>This is a test svg</desc><circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red"></circle></svg>"}