Mojolicious::Plugin::AssetPack::Pipe::Reloader - Automatically reload assets in browser
$app->plugin(AssetPack => {pipes => ["Reloader"]);
%= asset "reloader.js" if app->mode eq "development"
The reloader can be disabled by adding the query parameter "_assetpack_reload=false" to the url, or by setting window.ASSETPACK_RELOAD = false; in JavaScript.
window.ASSETPACK_RELOAD = false;
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.
$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".
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.
See "after_process" and "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.