Mojolicious::Plugin::AssetPack::Pipe::Reloader - Automatically reload assets in browser
$app->plugin(AssetPack => {pipes => ["Reloader"]);
%= asset "reloader.js" if app->mode eq "development"
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 feature is EXPERIMENTAL, UNSTABLE and only meant to be used while developing.
The environment variable MOJO_ASSETPACK_RELOAD_STRATEGY can either be set to "document" or "inline". "document" means that the whole document should reload when an asset change, while "inline" will try to figure out which "link" and "script" tags that changed and only reload those.
MOJO_ASSETPACK_RELOAD_STRATEGY
The default is "document" for now, but this might change in the future.
$hash = $self->input;
Holds a mapping between the input topic and the list of input assets.
$hash = $self->watch;
Holds a mapping between the input topic and the files on disk to watch.
This method builds up "input" and "watch".
See "before_process" in Mojolicious::Plugin::AssetPack::Pipe.
Used to add a special "reloader.js" asset and a "/mojo-assetpack-reloader-ws" WebSocket endpoint.
This method does nothing.
Mojolicious::Plugin::AssetPack.
To install Mojolicious::Plugin::AssetPack, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::AssetPack
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::AssetPack
For more information on module installation, please visit the detailed CPAN module installation guide.