NAME
CSS::SpriteMaker::Simple - generate CSS sprites from a bunch of images
SYNOPSIS
say CSS::SpriteMaker::Simple->new->spritify('pics', 'pic1.png')->css;
# or
CSS::SpriteMaker::Simple->new
->spritify('pics', 'pic1.png')->spurt('sprite.css');
...
<span class="sprite s-FILENAME-OF-PIC"></span>
<link rel="stylesheet" property="stylesheet" href="sprite.css">
</body>
</html>
DESCRIPTION
Generate a CSS sprite using given image files. The result is a a single chunk of CSS code, with images base64 encoded into it.
METHODS
new
my $s = CSS::SpriteMaker::Simple->new;
Creates and returns a new CSS::SpriteMaker::Simple
object.
Takes no arguments.
spritify
$s->spritify( qw/list of dirs with pics or pics/ );
$s->spritify( qw/list of dirs with pics or pics/, [qw/ignore these/] );
Returns its invocant. Takes a list of paths and searches them for pics to use as sprites. The last element can be an arrayref, in which case, this will be a list of filenames (no directory portion) that will be ignored.
Will croak if no paths are given or it has trouble creating the temporary directory to assemble the sprite in.
css
say $s->css;
Returns CSS code of the sprite. Must be called after a call to "spritify"
spurt
say $s->spurt('sprite.css');
Write CSS code of the sprite into a file. Must be called after a call to "spritify"
SEE ALSO
Mojolicious::Plugin::AssetPack
REPOSITORY
BUGS
AUTHOR
LICENSE
You can use and distribute this module under the same terms as Perl itself.
See the LICENSE
file included in this distribution for complete
details.