Update README with Phoenix live-reload config change (#57)

Co-authored-by: Mitchell Hanberg <mitch@mitchellhanberg.com>
This commit is contained in:
GarlandCrow 2020-03-19 08:35:34 +09:00 committed by GitHub
parent 73c3c45f27
commit 7d1e436ac6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View file

@ -104,6 +104,14 @@ See the [documentation](https://hexdocs.pm/temple/Temple.Engine.html#content) fo
# config.exs
config :phoenix, :template_engines, exs: Temple.Engine
# config/dev.exs
config :your_app, YourAppWeb.Endpoint,
live_reload: [
patterns: [
~r"lib/your_app_web/templates/.*(exs)$"
]
]
# your_app_web.ex
def view do
quote do

View file

@ -10,6 +10,14 @@ defmodule Temple.Engine do
# config.exs
config :phoenix, :template_engines, exs: Temple.Engine
# config/dev.exs
config :your_app, YourAppWeb.Endpoint,
live_reload: [
patterns: [
~r"lib/your_app_web/templates/.*(exs)$"
]
]
# your_app_web.ex
def view do
quote location: :keep do
@ -21,7 +29,7 @@ defmodule Temple.Engine do
## Usage
Temple templates use the `.exs` extension, because they are written with pure Elixir!
Temple templates use the `.exs` extension, because they are written with pure Elixir!
`assigns` (@conn, etc) are handled the same as normal `Phoenix.HTML.Engine` templates.