https://github.com/mindreframer/vite_phx
https://github.com/mindreframer/vite_phx
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mindreframer/vite_phx
- Owner: mindreframer
- License: mit
- Created: 2021-01-30T00:33:06.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-07-01T17:29:42.000Z (almost 2 years ago)
- Last Synced: 2025-04-11T12:52:06.904Z (12 months ago)
- Language: Elixir
- Size: 390 KB
- Stars: 31
- Watchers: 2
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Vite
[Vite.js]: https://vitejs.dev/
[](https://github.com/mindreframer/vite_phx/actions?query=workflow%3A%22CI%22)
Vite helps you to integrate [Vite.js] with Phoenix.
## Instructions
Add following lines to your layout template:
```elixir
<%# load the vite.js client script in dev/test environments %>
<%= Vite.vite_client() %>
<%# When using React.js, also include this preamble hot refresh code %>
<%= Vite.react_refresh_snippet() %>
<%#
entry point for your application
- delegates to [Vite.js] in dev / loads all modules / styles in production from the manifest.json
%>
<%= Vite.vite_snippet("src/main.tsx") %>
```
## Configuration
```elixir
# in config/config.exs
# Configure Vite
config :vite_phx,
release_app: :demo,
# to tell prod and dev env appart
environment: Mix.env(),
# this manifest is different from the Phoenix "cache_manifest.json"!
vite_manifest: "priv/static/manifest.json", # optional
phx_manifest: "priv/static/cache_manifest.json", # optional
dev_server_address: "http://localhost:3000" # optional
```
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `vite` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:vite_phx, "~> 0.2"}
]
end
```
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at [https://hexdocs.pm/vite](https://hexdocs.pm/vite).