The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mojolicious::Plugin::AssetPack::Manual::Modes - How AssetPack behaves in different modes

DESCRIPTION

Mojolicious::Plugin::AssetPack behaves different in "production" mode than in "development" mode. The reason for this is that is't often easier to track down bugs in a given file if it's not minified and crammed into one file.

MODES

Production mode

This plugin will compress sass, less, css, javascript and coffeescript with the help of external applications on startup. The result will be one file with all the sources combined. This file is stored in "Packed directory".

The files in the packed directory will have a checksum added to the filename which will ensure broken browsers request a new version once the file is changed. Example:

  <script src="/packed/app-ed6d968e39843a556dbe6dad8981e3e0.js">

This is done using "process".

Development mode

This plugin will expand the input files to multiple script or link tags which makes debugging and development easier.

This is done using "expand".

TIP! Make morbo watch your less/sass files as well:

  $ morbo -w lib -w templates -w public/sass

You can also set the "MOJO_ASSETPACK_NO_CACHE" environment variable to 1 to convert your less/sass/coffee files each time their asset directive is expanded (only works when "minify" is disabled).

Fallback

It is possible to instruct your application to load an old asset, if it fail to generate a new asset. This is done by setting the "fallback" in Mojolicious::Plugin::AssetPack attribute to a true value.

"add" in Mojolicious::Plugin::AssetPack will log the error if an old asset was found or throw the error if unable to.

The default value is "1" in production mode.

This feauture is EXPERIMENTAL. Feedback wanted.

AUTHOR

Jan Henning Thorsen - jhthorsen@cpan.org