NAME
Mojolicious::Plugin::AssetPack::Handler::Sprites - A URL handler for sprites:// assets
DESCRIPTION
Mojolicious::Plugin::AssetPack::Handler::Sprites is a module that can generate sprites from image files in a directory.
This module require Imager and Imager::File::PNG to work. Below you can see how to install it on Debian or Ubuntu:
$ apt-get install libpng12-dev
$ cpanm Imager::File::PNG
This class is EXPERIMENTAL.
ATTRIBUTES
asset_for
$asset = $self->asset_for($url, $assetpack);
This method finds images in the location specified in the $url
, and generates a sprite.
The returning $asset
contains CSS with classnames describing how to use each image. Example with $url
set to "sprites:///images/xyz".
.xyz { background: url(xyz-5200164c30fb8660952969caf0cefa3d.png) no-repeat; display: inline-block; }
.xyz.social-rss { background-position: 0px -0px; width: 34px; height: 30px; }
.xyz.social-github { background-position: 0px -30px; width: 40px; height: 40px; }
.xyz.social-chrome { background-position: 0px -70px; width: 32px; height: 32px; }
COPYRIGHT AND LICENSE
Copyright (C) 2014, Jan Henning Thorsen
This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.
AUTHOR
Jan Henning Thorsen - jhthorsen@cpan.org