stencil 0.2.0
“Compile-time SVG inliner for Phoenix components.”
Package first published within seven daysPackage under two months old
SHA-256a19a67755693e52b8e85aae827ce975b29da993e3a4ff3eca62894ce1ed6b52d
MaleculeH₂(Cm₂F)
Evidence
1# Stencil
2
3[](https://codeberg.org/w0u7/stencil/actions?workflow=ci.yml)
4[](https://codeberg.org/w0u7/stencil/tags)
5
6Compile-time SVG inliner for Phoenix components.
7
8Stencil reads SVG files from a directory at compile time and embeds them into a
9Phoenix component you can call from HEEx. The running app performs no disk I/O
10because the raw SVG bytes are baked into the module's beam fil …
11:14… ile automatically when an SVG changes on disk.
12
13This is a port of [Lucky Framework's
14implementation](https://luckyframework.org/guides/frontend/rend …
30:32… in your app, then create a thin wrapper module
31that uses `Stencil.Component`. The conventional location is
32`lib/my_app_web/components/inline_svg.ex …
1:28… do
2 @moduledoc """
3 Compile-time SVG inliner for Phoenix components.
4
5 Drop `use Stencil.Component` into any module to expose an `inline_svg/1`
6 Phoenix component. SVGs under the configured directory are read and
7 embedded at compile time; the running app performs no disk I/O.
8
9 defmodule MyAppWeb.Inl …
123:51… global: false)
124 end
125
126 defp read_svg(path) do
127 path
128 |> File.read!()
129 |> String.replace(~r/<\?xml[^>]+\?>/, "")
130 |> String.replace(~r/<!--.*?-->/s, "")
131 |> String.replace(~r/\n\s*/, " " …
No evidence locations were recorded for this file. Raw result