serum v1.0.0 Serum.Plugins.LiveReloader
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.
Called when Serum has rendered a full page and it's about to write to an output file.
Returns the version requirement of Serum.
Returns the version of the plugin.
Link to this section Functions
description()
Returns the short description of the plugin.
You must implement this callback, or the plugin may fail.
Callback implementation for Serum.Plugin.description/0
.
elixir()
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
.
implements()
Returns a list of optional callbacks which the plugin implements.
For example, if your plugin implements build_started/2
and finalizing/2
,
you must implement this callback so that it returns [:build_started, :finalizing]
.
You must implement this callback, or the plugin may fail.
Callback implementation for Serum.Plugin.implements/0
.
name()
Returns the name of the plugin.
You must implement this callback, or the plugin may fail.
Callback implementation for Serum.Plugin.name/0
.
rendered_page(file)
Called when Serum has rendered a full page and it's about to write to an output file.
Plugins can alter the raw contents of the page to be written.
Callback implementation for Serum.Plugin.rendered_page/1
.
serum()
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
.
version()
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
.