https://github.com/genieframework/genieautoreload.jl
AutoReload plugin for the Genie web framework
https://github.com/genieframework/genieautoreload.jl
Last synced: over 1 year ago
JSON representation
AutoReload plugin for the Genie web framework
- Host: GitHub
- URL: https://github.com/genieframework/genieautoreload.jl
- Owner: GenieFramework
- License: mit
- Created: 2019-07-17T15:07:11.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-12-11T19:29:48.000Z (over 1 year ago)
- Last Synced: 2025-02-20T19:19:25.146Z (over 1 year ago)
- Language: Julia
- Size: 43 KB
- Stars: 13
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GenieAutoReload plugin
## Auto reload functionality for Genie plugins.
GenieAutoReload monitors the indicated files and folders (recursively) and automatically recompiles the Julia code and reloads the corresponding browser window.
To use in the app, add the following lines of code:
```julia
using Genie, Genie.Renderer.Html # some app deps
# load GenieAutoReload
using GenieAutoReload
# UI rendering code
# As part of the HTML UI code we need to load the autoreload.js file
# so this needs to be added in order to output the corresponding
# tag.
view = [
p("Hello world")
Genie.Assets.channels_support() # auto-reload functionality relies on channels
GenieAutoReload.assets()
]
html(view)
# Enable autoreload
Genie.config.websockets_server = true
GenieAutoReload.autoreload(pwd())
```
By default autoreloading is activated only when the Genie app runs in development. To force it to run in other environments, use `GenieAutoReload.autoreload(devonly = false)`.
Similarely, the assets are included only when the Genie app runs in development (otherwise `assets()` won't return anything and won't inject the `<script>` tag). To enable the assets in other environments, use `GenieAutoReload.assets(devonly = false)`.