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.
100
101   register
102         $self->register($app, \%config);
103
104       Used to register the plugin in the application. %config can contain:
105
106       • helper
107
108         Name of the helper to add to the application. Default is "asset".
109
110       • pipes
111
112         This argument is mandatory and need to contain a complete list of
113         pipes that is needed. Example:
114
115           $app->plugin(AssetPack => {pipes => [qw(Sass Css Combine)]);
116
117       • proxy
118
119         A hash of proxy settings. Set this to 0 to disable proxy detection.
120         Currently only "no_proxy" is supported, which will set which requests
121         that should bypass the proxy (if any proxy is detected). Default is
122         to bypass all requests to localhost.
123
124         See "detect" in Mojo::UserAgent::Proxy for more information.
125

SEE ALSO

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

AUTHOR

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