serum v1.4.1 Serum.Plugins.LiveReloader View Source
A Serum plugin that injects the live reloader script at the end of HTML files.
Once the page is loaded inside your web browser, the injected script tries to connect to the Serum development server via WebSocket. When the page receives "reload" message from the server, it refreshes the current page.
If you disable this plugin, you need to manually refresh the page after you made some changes to your source files.
Using the Plugin
You usually don't want the script injected into pages when the Serum
development server is not running. Let the plugin run only when Mix.env()
is dev
, and run MIX_ENV=prod mix serum.build
when you are about to
publish your website.
# serum.exs:
%{
plugins: [
{Serum.Plugins.LiveReloader, only: :dev}
]
}
Link to this section Summary
Functions
Returns the short description of the plugin.
Returns the version requirement of Elixir.
Returns a list of optional callbacks which the plugin implements.
Returns the name of the plugin.
Callback implementation for Serum.Plugin.rendered_page/2
.
Returns the version requirement of Serum.
Returns the version of the plugin.
Link to this section Functions
Returns the short description of the plugin.
You must implement this callback, or the plugin may fail.
Callback implementation for Serum.Plugin.description/0
.
Returns the version requirement of Elixir.
Refer to this document for the string format.
You must implement this callback, or the plugin may fail.
Callback implementation for Serum.Plugin.elixir/0
.
Returns a list of optional callbacks which the plugin implements.
Each list item can be in one of two forms:
{callback_name, arity}
callback_name
- This is deprecated and left for compatibility. New Serum plugins must use the above format.
For example, if your plugin implements build_started/2
and finalizing/2
,
you must implement this callback so that it returns [build_started: 2, finalizing: 2]
.
You must implement this callback, or the plugin may fail.
Callback implementation for Serum.Plugin.implements/0
.
Returns the name of the plugin.
You must implement this callback, or the plugin may fail.
Callback implementation for Serum.Plugin.name/0
.
Callback implementation for Serum.Plugin.rendered_page/2
.
Returns the version requirement of Serum.
Refer to this document for the string format.
You must implement this callback, or the plugin may fail.
Callback implementation for Serum.Plugin.serum/0
.
Returns the version of the plugin.
The returned version string must follow the semantic versioning scheme.
You must implement this callback, or the plugin may fail.
Callback implementation for Serum.Plugin.version/0
.