Mojolicious-Plugin-AssetPack

 view release on metacpan or  search on metacpan

lib/Mojolicious/Plugin/AssetPack/Guides/Tutorial.pod  view on Meta::CPAN


Used to minify CSS.

=item * L<CSS::Sass> 3.3.0

Used to process and minify CSS.

=item * L<Imager::File::PNG> 0.90

TODO: Used to generate CSS sprites.

=item * L<JavaScript::Minifier::XS> 0.11

Used to minify JavaScript.

=back

=head2 Pipes

AssetPack does not do any heavy lifting itself: All the processing is left to
the L<pipe objects|Mojolicious::Plugin::AssetPack::Pipe>.

=over 2

=item * L<Mojolicious::Plugin::AssetPack::Pipe::CoffeeScript>

Process CoffeeScript coffee files. Should be loaded before
L<Mojolicious::Plugin::AssetPack::Pipe::JavaScript>.

=item * L<Mojolicious::Plugin::AssetPack::Pipe::Combine>

Combine multiple assets to one. Should be loaded last.

=item * L<Mojolicious::Plugin::AssetPack::Pipe::Css>

Minify CSS.

=item * L<Mojolicious::Plugin::AssetPack::Pipe::Favicon>

There is a special topic called "favicon.ico", combined with the
L<Mojolicious::Plugin::AssetPack::Pipe::Favicon> pipe which can be used to
describe favicons, touch icons and tile icons.

=item * L<Mojolicious::Plugin::AssetPack::Pipe::Fetch>

Will look for "url(...)" in CSS files and download the related assets.

=item * L<Mojolicious::Plugin::AssetPack::Pipe::JavaScript>

Minify JavaScript.

=item * L<Mojolicious::Plugin::AssetPack::Pipe::Jpeg>

Used to crush "jpeg" image files.

=item * L<Mojolicious::Plugin::AssetPack::Pipe::Less>

Process Less CSS files. Should be loaded before
L<Mojolicious::Plugin::AssetPack::Pipe::Css>.

=item * L<Mojolicious::Plugin::AssetPack::Pipe::Png>

Used to crush "png" image files.

=item * L<Mojolicious::Plugin::AssetPack::Pipe::Riotjs>

Process L<http://riotjs.com/> tag files. Should be loaded before
L<Mojolicious::Plugin::AssetPack::Pipe::JavaScript>.

=item * L<Mojolicious::Plugin::AssetPack::Pipe::Sass>

Process sass and scss files. Should be loaded before
L<Mojolicious::Plugin::AssetPack::Pipe::Css>.

=back

=head2 Where to place source files

The source/input files that make up a virtual asset (topic) can come from
either...

=head3 On disk

AssetPack will look for source files in the "assets" directory, relative to the
application L<home|Mojo/home>. Unlike the "public" directory, this directory is
not shared on the internet, but the generated assets will still be available
thanks to a custom L<route|Mojolicious::Plugin::AssetPack/route>.

L<Mojolicious::Plugin::AssetPack::Store> is a sub class of
L<Mojolicious::Static>, allowing it to find files relative to
L<Mojolicious::Static/paths>. For example, to change asset search paths, you
can do:

    $app->asset->store->paths(["/some/new/location", "/other/location"]);

=head3 DATA section

L<Mojolicious::Plugin::AssetPack::Store> is a sub class of
L<Mojolicious::Static>, allowing it to look for files in DATA sections of
L<Mojolicious::Static/classes>.

The DATA section can also be used to lookup "@import" files. (Currently only
supported by L<Mojolicious::Plugin::AssetPack::Pipe::Sass>)

=head3 Web

Any file starting with "http" or "https" will be downloaded from web using
L<Mojolicious::Plugin::AssetPack/ua>.

It will also parse recursively "@import" files and download those as well.
(Currently only supported by L<Mojolicious::Plugin::AssetPack::Pipe::Sass>)

Assets from web will be cached locally to prevent downloading new and untested
assets on each application startup.

=head3 Current Mojolicious application

See L<Mojolicious::Plugin::Assets::Guides::Cookbook/DYNAMIC ASSETS>.

=head2 Process assets



( run in 1.024 second using v1.01-cache-2.11-cpan-39bf76dae61 )