NAME

Web::AssetLib::Bundle - an indexed grouping of Web::AssetLib::Asset objects

SYNOPSIS

my $bundle = Web::AssetLib::Bundle->new();

my $asset = Web::AssetLib::Asset->new(
    type         => 'javascript',
    input_engine => 'LocalFile',
    rank         => -100,
    input_args => { path => "your/local/path/jquery.min.js", }
);

$bundle->addAsset( $asset );
$bundle->addAsset( '/my/local/file.js', '/my/local/file.css' );

$library->compile( bundle => $bundle );

ATTRIBUTES

assets

Arrayref of Web::AssetLib::Asset objects

METHODS

addAsset

addAssets

   $bundle->addAsset( 
       Web::AssetLib::Asset->new(
           type         => 'javascript',
           input_engine => 'LocalFile',
           rank         => -100,
           input_args => { path => "your/local/path/jquery.min.js", }
       );
   );

Adds an asset to the bundle. Accepts an array of Web::AssetLib::Asset instances, or an array of strings. Using a string is a shortcut for defining a LocalFile asset, with the type determined by the file extension.

as_html

   my $html_tag = $bundle->as_html( type => 'js', html_attrs => { async => 'async' } );

Returns an HTML-formatted string linking to bundle's output location. Only available after the bundle has been compiled, otherwise returns undef.

type is a required argument.

AUTHOR

Ryan Lang <rlang@cpan.org>