.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Mojolicious::Plugin::AssetPack::Guides::Developing 3pm" .TH Mojolicious::Plugin::AssetPack::Guides::Developing 3pm "2023-02-04" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Mojolicious::Plugin::AssetPack::Guides::Developing \- Developing with AssetPack .SH "OVERVIEW" .IX Header "OVERVIEW" This guide will provide a setup for effective development with Mojolicious::Plugin::AssetPack. .SH "GUIDE" .IX Header "GUIDE" .SS "Environment variables" .IX Subsection "Environment variables" It is possible to set environment variables to change the behavior of AssetPack: .IP "\(bu" 2 \&\s-1MOJO_ASSETPACK_DEBUG\s0 .Sp Set this environment variable to get more debug to \s-1STDERR.\s0 Currently you can set it to a value between 0 and 3, where 3 provides the most debug. .IP "\(bu" 2 \&\s-1MOJO_ASSETPACK_LAZY\s0 .Sp Set this environment variable if you want to delay processing the assets until they are requested. This can be very useful while developing when the assets are changed frequently. .SS "Faster development cycle" .IX Subsection "Faster development cycle" For a faster development cycle, you can use \s-1MOJO_ASSETPACK_LAZY\s0. This environment variable will make AssetPack only rebuild the asset that is in use on the current web page. .PP .Vb 1 \& $ MOJO_ASSETPACK_LAZY=1 morbo myapp.pl .Ve .SS "Enforcing production assets" .IX Subsection "Enforcing production assets" To be sure that production assets are built correctly, you can add a unit test like the one below. This is especially important if you are using \&\*(L"\s-1MOJO_ASSETPACK_LAZY\*(R"\s0. .PP .Vb 2 \& 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; .Ve .PP The \f(CW\*(C`element_exists()\*(C'\fR tests should match the topics defined when defining the different assets. .SH "Optional modules" .IX Header "Optional modules" There are some optional modules you might want to install: .IP "\(bu" 2 CSS::Minifier::XS .Sp Used by Mojolicious::Plugin::AssetPack::Pipe::Css. .IP "\(bu" 2 CSS::Sass .Sp Used by Mojolicious::Plugin::AssetPack::Pipe::Sass. .IP "\(bu" 2 IO::Socket::SSL .Sp Required if you want to download assets served over \s-1SSL.\s0 .IP "\(bu" 2 JavaScript::Minifier::XS .Sp Used by Mojolicious::Plugin::AssetPack::Pipe::JavaScript. .SH "SEE ALSO" .IX Header "SEE ALSO" Mojolicious::Plugin::AssetPack, Mojolicious::Plugin::AssetPack::Guides::Cookbook and Mojolicious::Plugin::AssetPack::Guides::Tutorial.