++ed by:
KEEDI GDT EITZ NEYASOV BEROV

24 PAUSE users
23 non-PAUSE users.

Author image Jan Henning Thorsen

NAME

Mojolicious::Plugin::AssetPack::Pipe::Reloader - Automatically reload assets in browser

SYNOPSIS

Application

  $app->plugin(AssetPack => {pipes => ["Reloader"]);

Template

  %= asset "reloader.js" if app->mode eq "development"

DESCRIPTION

Mojolicious::Plugin::AssetPack::Pipe::Reloader is a pipe which will create an asset called "reloader.js". This asset will automatically reload the page in the browser when one of the assets change on disk. This is done without the need of morbo.

This pipe should be loaded last to enable it to watch all input assets.

This feature is EXPERIMENTAL, UNSTABLE and only meant to be used while developing.

ATTRIBUTES

enabled

  $bool = $self->enabled;

This pipe is only enabled if either "MOJO_ASSETPACK_LAZY" in Mojolicious::Plugin::AssetPack is set or "mode" in Mojolicious is "development".

METHODS

after_process

This method will look for all the input assets and dependencies and add them to a list of watched files.

See "after_process" in Mojolicious::Plugin::AssetPack::Pipe.

before_process

See "after_process" and "before_process" in Mojolicious::Plugin::AssetPack::Pipe.

new

Used to add a special "reloader.js" asset and a "/mojo-assetpack-reloader-ws" WebSocket endpoint.

process

This method does nothing.

SEE ALSO

Mojolicious::Plugin::AssetPack.