.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" 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 3pm" .TH Mojolicious::Plugin::AssetPack 3pm "2021-02-20" "perl v5.32.1" "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 \- Compress and convert css, less, sass, javascript and coffeescript files .SH "DESCRIPTION" .IX Header "DESCRIPTION" Mojolicious::Plugin::AssetPack has a very limited feature set, especially when it comes to processing JavaScript. It is recommended that you switch to Mojolicious::Plugin::Webpack if you want to write modern JavaScript code. .SS "Existing user?" .IX Subsection "Existing user?" It is \fIvery\fR simple to migrate from Mojolicious::Plugin::AssetPack to Mojolicious::Plugin::Webpack. Just check out the one line change in \&\*(L"MIGRATING-FROM-ASSETPACK\*(R" in Mojolicious::Plugin::Webpack. .SS "Don't want to switch?" .IX Subsection "Don't want to switch?" Your existing code will probably continue to work for a long time, but it will get more and more difficult to write \fInew\fR working JavaScript with Mojolicious::Plugin::AssetPack as time goes by. .SS "New user?" .IX Subsection "New user?" Look no further. Just jump over to Mojolicious::Plugin::Webpack. .SH "HELPERS" .IX Header "HELPERS" .SS "asset" .IX Subsection "asset" .Vb 4 \& $self = $app\->asset; \& $self = $c\->asset; \& $bytestream = $c\->asset($topic, @args); \& $bytestream = $c\->asset("app.css", media => "print"); .Ve .PP \&\f(CW\*(C`asset()\*(C'\fR is the main entry point to this plugin. It can either be used to access the Mojolicious::Plugin::AssetPack instance or as a tag helper. .PP The helper name \*(L"asset\*(R" can be customized by specifying \*(L"helper\*(R" when registering the plugin. .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" .SS "minify" .IX Subsection "minify" .Vb 2 \& $bool = $self\->minify; \& $self = $self\->minify($bool); .Ve .PP Set this to true to combine and minify the assets. Defaults to false if \&\*(L"mode\*(R" in Mojolicious is \*(L"development\*(R" and true otherwise. .SS "route" .IX Subsection "route" .Vb 2 \& $route = $self\->route; \& $self = $self\->route($route); .Ve .PP A Mojolicious::Routes::Route object used to serve assets. The default route responds to \s-1HEAD\s0 and \s-1GET\s0 requests and calls \&\fBserve_asset()\fR on \*(L"store\*(R" to serve the asset. .PP The default route will be built and added to the application when \*(L"process\*(R" is called the first time. .SS "store" .IX Subsection "store" .Vb 2 \& $obj = $self\->store; \& $self = $self\->store(Mojolicious::Plugin::AssetPack::Store\->new); .Ve .PP Holds a Mojolicious::Plugin::AssetPack::Store object used to locate, store and serve assets. .SS "tag_for" .IX Subsection "tag_for" Deprecated. Use \*(L"renderer\*(R" in Mojolicious::Plugin::AssetPack::Asset instead. .SS "ua" .IX Subsection "ua" .Vb 1 \& $ua = $self\->ua; .Ve .PP Holds a Mojo::UserAgent which can be used to fetch assets either from local application or from remote web servers. .SH "METHODS" .IX Header "METHODS" .SS "pipe" .IX Subsection "pipe" .Vb 2 \& $obj = $self\->pipe($name); \& $obj = $self\->pipe("Css"); .Ve .PP Will return a registered pipe by \f(CW$name\fR or \f(CW\*(C`undef\*(C'\fR if none could be found. .SS "process" .IX Subsection "process" .Vb 2 \& $self = $self\->process($topic => @assets); \& $self = $self\->process($definition_file); .Ve .PP Used to process assets. A \f(CW$definition_file\fR can be used to define \f(CW$topic\fR and \f(CW@assets\fR in a separate file. .PP \&\f(CW$definition_file\fR defaults to \*(L"assetpack.def\*(R". .SS "processed" .IX Subsection "processed" .Vb 1 \& $collection = $self\->processed($topic); .Ve .PP Can be used to retrieve a Mojo::Collection object, with zero or more Mojolicious::Plugin::AssetPack::Asset objects. .SS "register" .IX Subsection "register" .Vb 1 \& $self\->register($app, \e%config); .Ve .PP Used to register the plugin in the application. \f(CW%config\fR can contain: .IP "\(bu" 2 helper .Sp Name of the helper to add to the application. Default is \*(L"asset\*(R". .IP "\(bu" 2 pipes .Sp This argument is mandatory and need to contain a complete list of pipes that is needed. Example: .Sp .Vb 1 \& $app\->plugin(AssetPack => {pipes => [qw(Sass Css Combine)]); .Ve .IP "\(bu" 2 proxy .Sp A hash of proxy settings. Set this to \f(CW0\fR to disable proxy detection. Currently only \*(L"no_proxy\*(R" is supported, which will set which requests that should bypass the proxy (if any proxy is detected). Default is to bypass all requests to localhost. .Sp See \*(L"detect\*(R" in Mojo::UserAgent::Proxy for more information. .SH "SEE ALSO" .IX Header "SEE ALSO" Mojolicious::Plugin::Webpack. .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2020, Jan Henning Thorsen .PP This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0. .SH "AUTHOR" .IX Header "AUTHOR" Jan Henning Thorsen \- \f(CW\*(C`jhthorsen@cpan.org\*(C'\fR .PP Alexander Rymasheusky .PP Mark Grimes \- \f(CW\*(C`mgrimes@cpan.org\*(C'\fR .PP Per Edin \- \f(CW\*(C`info@peredin.com\*(C'\fR .PP Viktor Turskyi