1Mojolicious::Plugin::AsUsseetrPaCcokn(t3r)ibuted Perl DoMcoujmoelnitcaitoiuosn::Plugin::AssetPack(3)
2
3
4

NAME

6       Mojolicious::Plugin::AssetPack - Compress and convert css, less, sass,
7       javascript and coffeescript files
8

DESCRIPTION

10       Mojolicious::Plugin::AssetPack has a very limited feature set,
11       especially when it comes to processing JavaScript. It is recommended
12       that you switch to Mojolicious::Plugin::Webpack if you want to write
13       modern JavaScript code.
14
15   Existing user?
16       It is very simple to migrate from Mojolicious::Plugin::AssetPack to
17       Mojolicious::Plugin::Webpack. Just check out the one line change in
18       "MIGRATING-FROM-ASSETPACK" in Mojolicious::Plugin::Webpack.
19
20   Don't want to switch?
21       Your existing code will probably continue to work for a long time, but
22       it will get more and more difficult to write new working JavaScript
23       with Mojolicious::Plugin::AssetPack as time goes by.
24
25   New user?
26       Look no further. Just jump over to Mojolicious::Plugin::Webpack.
27

HELPERS

29   asset
30         $self = $app->asset;
31         $self = $c->asset;
32         $bytestream = $c->asset($topic, @args);
33         $bytestream = $c->asset("app.css", media => "print");
34
35       "asset()" is the main entry point to this plugin. It can either be used
36       to access the Mojolicious::Plugin::AssetPack instance or as a tag
37       helper.
38
39       The helper name "asset" can be customized by specifying "helper" when
40       registering the plugin.
41

ATTRIBUTES

43   minify
44         $bool = $self->minify;
45         $self = $self->minify($bool);
46
47       Set this to true to combine and minify the assets. Defaults to false if
48       "mode" in Mojolicious is "development" and true otherwise.
49
50   route
51         $route = $self->route;
52         $self = $self->route($route);
53
54       A Mojolicious::Routes::Route object used to serve assets. The default
55       route responds to HEAD and GET requests and calls serve_asset() on
56       "store" to serve the asset.
57
58       The default route will be built and added to the application when
59       "process" is called the first time.
60
61   store
62         $obj = $self->store;
63         $self = $self->store(Mojolicious::Plugin::AssetPack::Store->new);
64
65       Holds a Mojolicious::Plugin::AssetPack::Store object used to locate,
66       store and serve assets.
67
68   tag_for
69       Deprecated. Use "renderer" in Mojolicious::Plugin::AssetPack::Asset
70       instead.
71
72   ua
73         $ua = $self->ua;
74
75       Holds a Mojo::UserAgent which can be used to fetch assets either from
76       local application or from remote web servers.
77

METHODS

79   pipe
80         $obj = $self->pipe($name);
81         $obj = $self->pipe("Css");
82
83       Will return a registered pipe by $name or "undef" if none could be
84       found.
85
86   process
87         $self = $self->process($topic => @assets);
88         $self = $self->process($definition_file);
89
90       Used to process assets. A $definition_file can be used to define $topic
91       and @assets in a separate file.
92
93       $definition_file defaults to "assetpack.def".
94
95   processed
96         $collection = $self->processed($topic);
97
98       Can be used to retrieve a Mojo::Collection object, with zero or more
99       Mojolicious::Plugin::AssetPack::Asset objects. Returns undef if $topic
100       is not defined with "process".
101
102   register
103         $self->register($app, \%config);
104
105       Used to register the plugin in the application. %config can contain:
106
107       · helper
108
109         Name of the helper to add to the application. Default is "asset".
110
111       · pipes
112
113         This argument is mandatory and need to contain a complete list of
114         pipes that is needed. Example:
115
116           $app->plugin(AssetPack => {pipes => [qw(Sass Css Combine)]);
117
118       · proxy
119
120         A hash of proxy settings. Set this to 0 to disable proxy detection.
121         Currently only "no_proxy" is supported, which will set which requests
122         that should bypass the proxy (if any proxy is detected). Default is
123         to bypass all requests to localhost.
124
125         See "detect" in Mojo::UserAgent::Proxy for more information.
126

SEE ALSO

128       Mojolicious::Plugin::Webpack.
129
131       Copyright (C) 2020, Jan Henning Thorsen
132
133       This program is free software, you can redistribute it and/or modify it
134       under the terms of the Artistic License version 2.0.
135

AUTHOR

137       Jan Henning Thorsen - "jhthorsen@cpan.org"
138
139       Alexander Rymasheusky
140
141       Mark Grimes - "mgrimes@cpan.org"
142
143       Per Edin - "info@peredin.com"
144
145       Viktor Turskyi
146
147
148
149perl v5.32.0                      2020-10-04 Mojolicious::Plugin::AssetPack(3)
Impressum