Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/axelson/scenic_live_reload
Live reload your scenic scenes, based on exsync
https://github.com/axelson/scenic_live_reload
Last synced: 2 months ago
JSON representation
Live reload your scenic scenes, based on exsync
- Host: GitHub
- URL: https://github.com/axelson/scenic_live_reload
- Owner: axelson
- License: apache-2.0
- Created: 2019-07-06T23:48:39.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-03-30T15:59:21.000Z (almost 2 years ago)
- Last Synced: 2024-10-15T19:42:35.384Z (3 months ago)
- Language: Elixir
- Homepage:
- Size: 166 KB
- Stars: 15
- Watchers: 2
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ScenicLiveReload
A live reloader for Scenic. Once configured, when you edit a file the current
root scene will be killed, when it is restarted it will use any new code
currently in the running beam instance.How it works:
* Uses [exsync](https://github.com/axelson/exsync) to watch the file system
* When you edit a file with your editor, exsync recompiles and reloads that beam file
* `exsync` notifies `scenic_live_reload` that files were reloaded
* `scenic_live_reload` kills the currently displayed root scene
* The OTP Supervisor for that scene restarts the scene with the updated code# Demo
In this demo I replace the text "World" with "Scenic", then change the color of
the text to purple. Next I change the shape of the bezier line.[![Screencast Demo](./demo.gif)](https://raw.githubusercontent.com/axelson/scenic-starter-pack/master/demo.gif)
Note: the code running in the demo can be found at https://github.com/axelson/scenic_live_reload_demo
See also: [scenic-starter-pack](https://github.com/axelson/scenic-starter-pack)
# Installation
Add `scenic_live_reload` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
...
{:scenic_live_reload, "~> 0.3", only: :dev},
]
end
```Add this configuration to your `config.exs`:
```
case Mix.env() do
:dev ->
config :exsync,
reload_timeout: 150,
reload_callback: {ScenicLiveReload, :reload_current_scenes, []}_ ->
nil
end
```Then start your application with `mix scenic.run` (or `iex -S mix`), edit a file with your editor, and then you should see your change reflected.
# Development
NOTE: This currently relies on a private scenic api to get the root scene which may change in future Scenic releases