NAME

Mojolicious::Plugin::AssetPack::Asset - An asset

DESCRIPTION

Mojolicious::Plugin::AssetPack::Asset represents an asset.

SYNOPSIS

use Mojolicious::Plugin::AssetPack::Asset;
my $asset = Mojolicious::Plugin::AssetPack::Asset->new(url => "...");

ATTRIBUTES

checksum

$str = $self->checksum;
$self = $self->checksum($str);

The checksum of "content".

format

$str = $self->format;
$self = $self->format($str);

The format of "content". Defaults to the extension of "url" or empty string.

minified

$bool = $self->minified;
$self = $self->minified($bool);

Will be set to true if either "url" contains "min" or if a pipe has minified "content".

mtime

$epoch = $self->mtime;
$self = $self->mtime($epoch);

Holds the modification time of "content".

name

$str = $self->name;

Returns the basename of "url", without extension.

tag_helper

$self = $self->tag_helper("stylesheet");
$str = $self->tag_helper;

Used to get the Mojolicious tag helper which should be used to render this asset.

This could be set to "image" by a pipe, but defaults to either "stylesheet" or "javascript", based on "format".

url

$str = $self->url;

Returns the location of the asset.

METHODS

content

$bytes = $self->content;
$self = $self->content($bytes);
$self = $self->content(Mojo::Asset::Memory->new);

Used to get or set the content of this asset. The default will be built from passing "url" to "file" in Mojolicious::Plugin::AssetPack::Store.

get_chunk

See "get_chunk" in Mojo::Asset.

path

$str = $self->path;

Returns the path to the asset, if it exists on disk.

size

See "size" in Mojo::Asset.

FROM_JSON

$self = $self->FROM_JSON($hash_ref);

The opposite of "TO_JSON". Will set the read/write "ATTRIBUTES" from the values in $hash_ref.

TO_JSON

$hash_ref = $self->FROM_JSON;

The opposite of "FROM_JSON". Will generate a hash ref from "ATTRIBUTES".

SEE ALSO

Mojolicious::Plugin::AssetPack.