https://github.com/drowzy/phx_svg
Precompile svg
https://github.com/drowzy/phx_svg
Last synced: 10 months ago
JSON representation
Precompile svg
- Host: GitHub
- URL: https://github.com/drowzy/phx_svg
- Owner: drowzy
- License: mit
- Created: 2022-11-11T12:41:11.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-15T15:27:56.000Z (over 3 years ago)
- Last Synced: 2025-08-19T05:26:13.976Z (10 months ago)
- Language: Elixir
- Size: 14.6 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Phx.Svg
[](https://hex.pm/packages/phx_svg)
Precompile SVGS to functions. Packaged as a `Phoenix Component`
## Options
* `svg_path` - Wildcard path to svgs ex `./path/to/**/.svg`
* `mod_name` - Module name to use for generated files defaults to: `SVG`
* `output_path` - Output path defautl: `lib/icons.ex`
## Usage
```sh
mix phx_svg.build \
--mod-name=MySvgs \
--svg-path="path/to/svgs/**/*.svg" \
--output-path="./lib/my_app_web/components/svgs.ex"
```
In a `HEEX` template:
```elixir
def render(assigns) do
~H"""
"""
end
```
## Installation
The package can be installed by adding `phx_svg` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:phx_svg, "~> 0.1.0", only: [:dev], runtime: false}
]
end
```