Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/falood/exsync
Yet another elixir reloader.
https://github.com/falood/exsync
Last synced: 1 day ago
JSON representation
Yet another elixir reloader.
- Host: GitHub
- URL: https://github.com/falood/exsync
- Owner: falood
- License: bsd-3-clause
- Created: 2014-11-03T05:03:17.000Z (about 10 years ago)
- Default Branch: main
- Last Pushed: 2024-07-14T14:11:37.000Z (7 months ago)
- Last Synced: 2025-01-17T21:04:05.367Z (8 days ago)
- Language: Elixir
- Size: 80.1 KB
- Stars: 164
- Watchers: 7
- Forks: 27
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - Yet another Elixir reloader. (Miscellaneous)
- fucking-awesome-elixir - exsync - Yet another Elixir reloader. (Miscellaneous)
- awesome-elixir - exsync - Yet another Elixir reloader. (Miscellaneous)
README
ExSync
======An Elixir reloader. When your code changes, ExSync automatically recompiles it.
Supports recompiling `:path` dependencies without additional configuration. Also
supports a `:reload_callback` which is an MFA (Module Function Arguments) that
will be called after each time the code is recompiled.## System Support
ExSync depends on [FileSystem](https://github.com/falood/file_system) which has
some required dependencies.## Usage
1. Create a new application:
```bash
mix new my_app
```2. Add exsync to your `mix.exs` dependencies:
```elixir
def deps do
[
{:exsync, "~> 0.4", only: :dev},
]
end
```NOTE: if you have an umbrella application then add ExSync to one the apps in the umbrella.
## Config
All configuration for this library is handled via the application environment.
`:addition_dirs` - Additional directories to monitor
For example, to monitor the `priv` directory, add this to your `config.exs`:
```elixir
config :exsync, addition_dirs: ["/priv"]
````:extensions` - List of file extensions to watch for changes. Defaults to: `[".erl", ".hrl", ".ex", ".eex"]`
`:extra_extensions` - List of additional extensions to watch for changes (cannot be used with `:extensions`)
For example, to watch `.js` and `.css` files add this to your `config.exs`:
```elixir
config :exsync, extra_extensions: [".js", ".css"]
````:exclusions` - List of regular expressions that, if matched, exclude a file from being noticed by exsync.
For example, to exclude Emacs temporary files:
```elixir
config :exsync, exclusions: [~r/#/]
````:logging_enabled` - Set to false to disable logging (default true)
`:reload_callback` - A callback [MFA](https://codereviewvideos.com/blog/what-is-mfa-in-elixir/) that is called when a set of files are done reloading. Can be used to implement your own special handling to react to file reloads.
`:reload_timeout` - Amount of time to wait in milliseconds before triggering the `:reload_callback`. Defaults to 150ms.
For example, to call `MyApp.MyModule.handle_reload()` add this to your `config.exs`:
```elixir
config :exsync,
reload_timeout: 75,
reload_callback: {MyApp.MyModule, :handle_reload, []}
```