CSS-Prepare
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
#!/usr/bin/env perl
use Modern::Perl;
use CSS::Prepare;
use Getopt::Long qw( :config bundling );
use Pod::Usage;
use constant OPTIONS => qw(
help|h
assets-output|m=s
assets-base|n=s
);
use constant REQUIRED_OPTIONS => qw( assets-output );
my %option = get_options_or_exit();
my $preparer = CSS::Prepare->new(
assets_base => $option{'assets-base'},
assets_output => $option{'assets-output'},
);
foreach my $arg ( @ARGV ) {
my $output = $preparer->copy_file_to_staging( $arg );
say $output
if defined $option{'assets-base'};
}
exit;
sub get_options_or_exit {
my %getopts = @_;
my $known = GetOptions( \%getopts, OPTIONS );
my $usage = ! $known || $getopts{'help'};
foreach my $key ( REQUIRED_OPTIONS ) {
$usage = 1
unless defined $getopts{ $key };
}
pod2usage() if $usage;
return %getopts;
}
__END__
=head1 NAME
B<assets> - synchronise files to the assets staging area
=head1 SYNOPSIS
B<assets> B<--assets-output F<dir> --assets-base F<URI> F<file>> [...]
=head1 DESCRIPTION
Copies all F<file> arguments to the output F<dir>, using the same SHA1
naming scheme as L<CSS::Prepare> uses. This allows you to upload static
assets in the same way, without the requirement of them needing to be
referenced in your CSS.
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.426 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )