1Mojolicious::Plugin::AsUsseetrMPoaCjcooknl:ti:rcGiiuboiuudtsee:sd::P:PlDeuergvlienlD:oo:pcAiusnmsgee(nt3tP)aatciko:n:Guides::Developing(3)
2
3
4
6 Mojolicious::Plugin::AssetPack::Guides::Developing - Developing with
7 AssetPack
8
10 This guide will provide a setup for effective development with
11 Mojolicious::Plugin::AssetPack.
12
14 Environment variables
15 It is possible to set environment variables to change the behavior of
16 AssetPack:
17
18 · MOJO_ASSETPACK_DEBUG
19
20 Set this environment variable to get more debug to STDERR. Currently
21 you can set it to a value between 0 and 3, where 3 provides the most
22 debug.
23
24 · MOJO_ASSETPACK_LAZY
25
26 Set this environment variable if you want to delay processing the
27 assets until they are requested. This can be very useful while
28 developing when the assets are changed frequently.
29
30 Faster development cycle
31 For a faster development cycle, you can use MOJO_ASSETPACK_LAZY. This
32 environment variable will make AssetPack only rebuild the asset that is
33 in use on the current web page.
34
35 $ MOJO_ASSETPACK_LAZY=1 morbo myapp.pl
36
37 Enforcing production assets
38 To be sure that production assets are built correctly, you can add a
39 unit test like the one below. This is especially important if you are
40 using "MOJO_ASSETPACK_LAZY".
41
42 use Test::Mojo;
43 use Test::More;
44
45 $ENV{MOJO_MODE} = "production";
46 my $t = Test::Mojo->new("MyApp");
47
48 $t->get_ok("/")
49 ->element_exists(q(head link[href$="/app.css"]))
50 ->element_exists(q(body script[src$="/app.js"]));
51
52 done_testing;
53
54 The "element_exists()" tests should match the topics defined when
55 defining the different assets.
56
58 There are some optional modules you might want to install:
59
60 · CSS::Minifier::XS
61
62 Used by Mojolicious::Plugin::AssetPack::Pipe::Css.
63
64 · CSS::Sass
65
66 Used by Mojolicious::Plugin::AssetPack::Pipe::Sass.
67
68 · IO::Socket::SSL
69
70 Required if you want to download assets served over SSL.
71
72 · JavaScript::Minifier::XS
73
74 Used by Mojolicious::Plugin::AssetPack::Pipe::JavaScript.
75
77 Mojolicious::Plugin::AssetPack,
78 Mojolicious::Plugin::AssetPack::Guides::Cookbook and
79 Mojolicious::Plugin::AssetPack::Guides::Tutorial.
80
81
82
83perl v5.30.1 Mojolicio2u0s2:0:-P0l1u-g3i0n::AssetPack::Guides::Developing(3)