CSS-SpriteBuilder

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

NAME
    CSS::SpriteBuilder - CSS sprite builder.

SYNOPSIS
        use CSS::SpriteBuilder

        my $builder = CSS::SpriteBuilder->new( [%args] );
        $builder->build(
            sprites => [{
                file   => 'sample_sprite_%d.png',
                images => [
                    { file => 'small/Add.png', [ %options ] },
                ],
                [ %options ],
            }],
        );

        $build->write_css('sprite.css');

        Or

        $builder->build(config => 'config.xml');

        $build->write_css('sprite.css');

DESCRIPTION
    This module generate CSS sprites with one of these modules:
    Image::Magick or GD.

    It has many useful settings and can be used for sites with complex
    structure.

METHODS
  new(<%args>)
    my $builder = CSS::SpriteBuilder->new(<%args>);

    Create instance.

    Valid arguments are:

    *   source_dir [ = undef ]

        Specify custom location for source images.

    *   output_dir [ = undef ]

        Specify custom location for generated images.

    *   image_quality 0..100 [ = 90 ]

        Specify image quality for generated images (for JPEG only).

    *   max_image_size [ = 65536 ]

        Specify max size of images that will be used to generate a sprite.

    *   max_image_width [ = 2000 ]

        Specify max width of images that will be used to generate a sprite.

    *   max_image_height [ = 2000 ]

        Specify max height of images that will be used to generate a sprite.

    *   max_sprite_width [ = 2000 ]

        Specify max width of sprite. When sprite has no free space, than
        creates a new sprite with addition of a suffix to the sprite name.
        Opera 9.0 and below have a bug which affects CSS background offsets
        less than -2042px. All values less than this are treated as -2042px
        exactly.

    *   max_sprite_height [ = 2000 ]

        Specify max height of sprite.

    *   margin [ = 0 ]

        Add margin to each image.

    *   transparent_color [ = undef ]

        Set transparent color for image, for example: 'white', 'black', ....

    *   is_background [ = 0 ]

        If is_background flag is '0' will be generated CSS rule such as:
        'width:XXXpx;height:YYYpx;'.



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