Web::AssetLib::Bundle - an indexed grouping of Web::AssetLib::Asset objects
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 );
Arrayref of Web::AssetLib::Asset objects
$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.
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.
type
Ryan Lang <rlang@cpan.org>
To install Web::AssetLib, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Web::AssetLib
CPAN shell
perl -MCPAN -e shell install Web::AssetLib
For more information on module installation, please visit the detailed CPAN module installation guide.