package File::Assets::Asset; use warnings; use strict; use File::Assets::Util; use File::Assets::Carp; use File::Assets::Asset::Content; use XML::Tiny; use IO::Scalar; use Object::Tiny qw/type rank attributes hidden rsc outside/; use Scalar::Util qw/blessed/; =head1 SYNPOSIS my $asset = File::Asset->new(base => $base, path => "/static/assets.css"); $asset = $assets->include("/static/assets.css"); # Or, like this, usually. print "The rank for asset at ", $asset->uri, " is ", $asset->rank, "\n"; print "The file for the asset is ", $asset->file, "\n"; =head1 DESCRIPTION A File::Asset object represents an asset existing in both URI-space and file-space (on disk). The asset is usually a .js (JavaScript) or .css (CSS) file. =head1 METHODS =head2 File::Asset->new( base => , path => , [ rank => , type => ]) Creates a new File::Asset. You probably don't want to use this, create a L object and use $assets->include instead. =cut sub _html_parse ($) { XML::Tiny::parsefile(IO::Scalar->new(shift)); } sub new { my $self = bless {}, shift; my $asset = @_ == 1 && ref $_[0] eq "HASH" ? shift : { @_ }; my $content = delete $asset->{content}; $content = ref $content eq "SCALAR" ? $$content : $content; if (defined $content && $content =~ m/^\s* or