Mojolic...eloping(3)

okay so bestie, welcome to the Mojolic...eloping(3) page β€” yep, a User Contributed Perl Documentation moment β€” and the guide it’s serving is Mojolicious::Plugin::AssetPack::Guides::Developing. Let’s get you set up πŸ’…

πŸŽ€ NAME πŸŽ€

Mojolicious::Plugin::AssetPack::Guides::Developing - Developing with AssetPack

🌸 OVERVIEW 🌸

This guide is gonna give you a setup for effective development with Mojolicious::Plugin::AssetPack. slay, no cap.

✨ GUIDE ✨

πŸ”§ Environment variables πŸ”§

So you can set environment variables to change how AssetPack behaves, bestie:

  • MOJO_ASSETPACK_DEBUG β€” Set this environment variable to get more debug output to STDERR. Currently you can set it to a value between 0 and 3, where 3 gives the most debug. periodt
  • MOJO_ASSETPACK_LAZY β€” Set this environment variable if you want to delay processing the assets until they’re requested. This can be very useful while developing when the assets are changed frequently.

⚑ Faster development cycle ⚑

For a faster development cycle, use MOJO_ASSETPACK_LAZY. This environment variable makes AssetPack only rebuild the asset that’s in use on the current web page. it’s giving efficient:

$ MOJO_ASSETPACK_LAZY=1 morbo myapp.pl

πŸš€ Enforcing production assets πŸš€

To be sure production assets are built correctly, add a unit test like the one below. This is especially important if you’re using MOJO_ASSETPACK_LAZY.

use Test::Mojo;
use Test::More;

$ENV{MOJO_MODE} = "production";
my $t = Test::Mojo->new("MyApp");

$t->get_ok("/")
  ->element_exists(q(head link[href$="/app.css"]))
  ->element_exists(q(body script[src$="/app.js"]));

done_testing;
The element_exists() tests should match the topics defined when defining the different assets. fr fr

🧚 Optional modules 🧚

There are some optional modules you might want to install:

  • CSS::Minifier::XS β€” Used by Mojolicious::Plugin::AssetPack::Pipe::Css.
  • CSS::Sass β€” Used by Mojolicious::Plugin::AssetPack::Pipe::Sass.
  • IO::Socket::SSL β€” Required if you want to download assets served over SSL.
  • JavaScript::Minifier::XS β€” Used by Mojolicious::Plugin::AssetPack::Pipe::JavaScript.

πŸ‘€ SEE ALSO πŸ‘€

  • Mojolicious::Plugin::AssetPack
  • Mojolicious::Plugin::AssetPack::Guides::Cookbook
  • Mojolicious::Plugin::AssetPack::Guides::Tutorial

mwah πŸ’‹ β€” this page was brought to you by perl v5.42.0, dated 2024-12-12, and the Mojolic...eloping(3) manual. bye bestie 🫢

πŸ“¦ where this page comes from