Group
Extension

Matches 15

Mojolicious-Plugin-AssetPack ( S/SR/SRI/Mojolicious-Plugin-AssetPack-2.15.tar.gz, SRI, 2024; MetaCPAN )
Mojolicious-Plugin-AssetPack/lib/Mojolicious/Plugin/AssetPack/Store.pm ( view source; MetaCPAN )
ave an asset to disk. C<%attr> are usually the same as
L<Mojolicious::Plugin::AssetPack::Asset/TO_JSON> and used to document metadata
about the C<$asset> so it can be looked up using L</load>.

=head2
y $asset (@$assets) {
@import "<%= $asset->url_for($c) %>";
% }
@@ fallback.js.ep
% use Mojo::JSON 'to_json';
(function(w,d,a,b){
var c=function(){
var t=d.createElement("script");
t.src=b.shift();
if
(b.length) t.addEventListener("load",c);
a.parentNode.insertBefore(t,a);
};
c();
})(window,document,document.getElementsByTagName("script")[0],<%= to_json([map { $_->url_for($c) } @$assets]) %>);
Mojolicious-Plugin-AssetPack ( S/SR/SRI/Mojolicious-Plugin-AssetPack-2.15.tar.gz, SRI, 2024; MetaCPAN )
Mojolicious-Plugin-AssetPack/lib/Mojolicious/Plugin/AssetPack/Pipe/TypeScript.pm ( view source; MetaCPAN )
  my $attrs = $asset->TO_JSON;
    $attrs->{key}    = 'ts';
    $attrs->{format} = 'js';
    return unless $asset->format eq 'ts';
    return $asset->content($file)->FROM_JSON($attrs) if $file = $stor
f->_typescript, \$asset->content, \my $js);
    $asset->content($store->save(\$js, $attrs))->FROM_JSON($attrs);
  });
}

sub _install_typescript {
  my $self = shift;

  # TODO: This is a bit fragile,
Mojolicious-Plugin-AssetPack ( S/SR/SRI/Mojolicious-Plugin-AssetPack-2.15.tar.gz, SRI, 2024; MetaCPAN )
Mojolicious-Plugin-AssetPack/lib/Mojolicious/Plugin/AssetPack/Pipe/JavaScript.pm ( view source; MetaCPAN )
ck->minify;
  return $assets->each(sub {
    my ($asset, $index) = @_;
    my $attrs = $asset->TO_JSON;
    $attrs->{key}      = 'js-min';
    $attrs->{minified} = 1;
    return if $asset->format ne '
Mojolicious-Plugin-AssetPack ( S/SR/SRI/Mojolicious-Plugin-AssetPack-2.15.tar.gz, SRI, 2024; MetaCPAN )
Mojolicious-Plugin-AssetPack/lib/Mojolicious/Plugin/AssetPack/Pipe/Png.pm ( view source; MetaCPAN )
 my $file;

  return $assets->each(sub {
    my ($asset, $index) = @_;
    my $attrs = $asset->TO_JSON;
    $attrs->{key}      = sprintf '%s-min', $self->app;
    $attrs->{minified} = 1;
    return if
rs->{checksum} if DEBUG;
    $asset->content($store->save($self->_run_app($asset), $attrs))->FROM_JSON($attrs);
  });
}

sub _install_optipng {
  my $self  = shift;
  my $class = ref $self;
  my $app 
Mojolicious-Plugin-AssetPack ( S/SR/SRI/Mojolicious-Plugin-AssetPack-2.15.tar.gz, SRI, 2024; MetaCPAN )
Mojolicious-Plugin-AssetPack/lib/Mojolicious/Plugin/AssetPack/Pipe/RollupJs.pm ( view source; MetaCPAN )
:Base 'Mojolicious::Plugin::AssetPack::Pipe';

use Mojo::File qw(path tempfile);
use Mojo::JSON qw(encode_json false true);
use Mojo::Loader;
use Mojolicious::Plugin::AssetPack::Util qw(diag $CWD DEBU
f '%s(%s)', $func, defined $args ? encode_json $args : '';
  }

  $bin =~ s!__EXTERNAL__!{encode_json $self->external}!e;
  $bin =~ s!__GLOBALS__!{encode_json $self->globals}!e;
  $bin =~ s!__SOURCEMA
s _rollupjs_src);

  $assets->each(sub {
    my ($asset, $index) = @_;
    my $attrs = $asset->TO_JSON;
    return unless $asset->format eq 'js';
    return unless $asset->path and -r $asset->path;
  
Mojolicious-Plugin-AssetPack ( S/SR/SRI/Mojolicious-Plugin-AssetPack-2.15.tar.gz, SRI, 2024; MetaCPAN )
Mojolicious-Plugin-AssetPack/lib/Mojolicious/Plugin/AssetPack/Pipe/Css.pm ( view source; MetaCPAN )
ck->minify;
  return $assets->each(sub {
    my ($asset, $index) = @_;
    my $attrs = $asset->TO_JSON;
    $attrs->{key}      = 'css-min';
    $attrs->{minified} = 1;
    return if $asset->format ne 
Mojolicious-Plugin-AssetPack ( S/SR/SRI/Mojolicious-Plugin-AssetPack-2.15.tar.gz, SRI, 2024; MetaCPAN )
Mojolicious-Plugin-AssetPack/lib/Mojolicious/Plugin/AssetPack/Pipe.pm ( view source; MetaCPAN )
;

use File::Temp ();
use IPC::Run3  ();
use List::Util 'first';
use Mojo::File 'path';
use Mojo::JSON;
use Mojolicious::Plugin::AssetPack::Asset;
use Mojolicious::Plugin::AssetPack::Util qw(diag has_
ind_app([qw(nodejs node)]), $REQUIRE_JS, @modules], \undef, \my $status);
  $status = Mojo::JSON::decode_json($status);

  for my $plugin (@modules) {
    next unless $status->{$plugin};
    $self->ap
       # Change $attr if this pipe will modify $asset attributes
        my $attr    = $asset->TO_JSON;
        my $content = $asset->content;

        # Private name to load/save meta data under
    
Mojolicious-Plugin-AssetPack ( S/SR/SRI/Mojolicious-Plugin-AssetPack-2.15.tar.gz, SRI, 2024; MetaCPAN )
Mojolicious-Plugin-AssetPack/lib/Mojolicious/Plugin/AssetPack/Pipe/Favicon.pm ( view source; MetaCPAN )
::Pipe::Favicon;
use Mojo::Base 'Mojolicious::Plugin::AssetPack::Pipe';

use Mojo::DOM;
use Mojo::JSON qw(false true);
use Mojo::Template;
use Mojo::Util;
use Mojolicious::Plugin::AssetPack::Util 'che
sign   => sub { shift->_build_design };
has settings => sub { +{error_on_image_too_small => Mojo::JSON->true} };

sub process {
  my ($self, $assets) = @_;
  return unless $self->topic =~ m!^favicon(\
 my $asset = $assets->first;
  my $attrs = $asset->TO_JSON;
  my ($urls, $markup, %sub_assets);

  $attrs->{key} = checksum(Mojo::JSON::encode_json($self->design))
    or die '[AssetPack] Invalid pipe
Mojolicious-Plugin-AssetPack ( S/SR/SRI/Mojolicious-Plugin-AssetPack-2.15.tar.gz, SRI, 2024; MetaCPAN )
Mojolicious-Plugin-AssetPack/lib/Mojolicious/Plugin/AssetPack/Pipe/Less.pm ( view source; MetaCPAN )
$asset->format ne 'less';
    my $attrs = $asset->TO_JSON;
    @$attrs{qw(format key)} = qw(css less);
    return $asset->content($file)->FROM_JSON($attrs) if $file = $store->load($attrs);
    diag 'P
;
    $self->run(\@args, undef, \my $css);
    $asset->content($store->save(\$css, $attrs))->FROM_JSON($attrs);
  });
}

sub _install_lessc {
  my $self = shift;
  my $bin  = $self->app->home->rel_fil
Mojolicious-Plugin-AssetPack ( S/SR/SRI/Mojolicious-Plugin-AssetPack-2.15.tar.gz, SRI, 2024; MetaCPAN )
Mojolicious-Plugin-AssetPack/lib/Mojolicious/Plugin/AssetPack/Pipe/Jpeg.pm ( view source; MetaCPAN )
 my $file;

  return $assets->each(sub {
    my ($asset, $index) = @_;
    my $attrs = $asset->TO_JSON;
    $attrs->{key}      = sprintf '%s-min', $self->app;
    $attrs->{minified} = 1;
    return if
rs->{checksum} if DEBUG;
    $asset->content($store->save($self->_run_app($asset), $attrs))->FROM_JSON($attrs);
  });
}

sub _install_jpegoptim {
  my $self  = shift;
  my $class = ref $self;
  die "$
Mojolicious-Plugin-AssetPack ( S/SR/SRI/Mojolicious-Plugin-AssetPack-2.15.tar.gz, SRI, 2024; MetaCPAN )
Mojolicious-Plugin-AssetPack/lib/Mojolicious/Plugin/AssetPack/Pipe/Riotjs.pm ( view source; MetaCPAN )
 my $attrs = $asset->TO_JSON;
    $attrs->{key}    = 'riot';
    $attrs->{format} = 'js';
    return unless $asset->format eq 'tag';
    return $asset->content($file)->FROM_JSON($attrs) if $file = $st
>_riotjs,       \$asset->content, \my $js);
    $asset->content($store->save(\$js, $attrs))->FROM_JSON($attrs);
  });
}

sub _install_riot {
  my $self = shift;
  my $path = $self->app->home->rel_file
Mojolicious-Plugin-AssetPack ( S/SR/SRI/Mojolicious-Plugin-AssetPack-2.15.tar.gz, SRI, 2024; MetaCPAN )
Mojolicious-Plugin-AssetPack/lib/Mojolicious/Plugin/AssetPack/Pipe/Sass.pm ( view source; MetaCPAN )
ssetPack::Util qw(checksum diag dumper load_module DEBUG);
use Mojo::File;
use Mojo::JSON qw(decode_json encode_json);
use Mojo::Util;

my $FORMAT_RE              = qr{^s[ac]ss$};
my $IMPORT_RE       
index) = @_;

    return if $asset->format !~ $FORMAT_RE;
    my ($attrs, $content) = ($asset->TO_JSON, $asset->content);
    local $self->{checksum_for_file} = {};
    local $opts{include_paths}[0] =
elf->_checksum(\$content, $asset, $opts{include_paths});

    return $asset->content($file)->FROM_JSON($attrs) if $file = $store->load($attrs);
    return if $asset->isa('Mojolicious::Plugin::AssetPac
Mojolicious-Plugin-AssetPack ( S/SR/SRI/Mojolicious-Plugin-AssetPack-2.15.tar.gz, SRI, 2024; MetaCPAN )
Mojolicious-Plugin-AssetPack/lib/Mojolicious/Plugin/AssetPack/Pipe/Fetch.pm ( view source; MetaCPAN )
elf->assetpack->process($related->name, $related);
        my $path = $route->render($related->TO_JSON);
        $path =~ s!^/!!;
        my $up = join '', map {'../'} $path =~ m!\/!g;
        $relate
Mojolicious-Plugin-AssetPack ( S/SR/SRI/Mojolicious-Plugin-AssetPack-2.15.tar.gz, SRI, 2024; MetaCPAN )
Mojolicious-Plugin-AssetPack/lib/Mojolicious/Plugin/AssetPack/Pipe/CoffeeScript.pm ( view source; MetaCPAN )
sset->format ne 'coffee';
    my $attrs = $asset->TO_JSON;
    @$attrs{qw(format key)} = qw(js coffee);
    return $asset->content($file)->FROM_JSON($attrs) if $file = $store->load($attrs);
    diag '
pile --stdio)], \$asset->content, \my $js);
    $asset->content($store->save(\$js, $attrs))->FROM_JSON($attrs);
  });
}

sub _install_coffee {
  my $self = shift;
  my $path = $self->app->home->rel_fi
Mojolicious-Plugin-AssetPack ( S/SR/SRI/Mojolicious-Plugin-AssetPack-2.15.tar.gz, SRI, 2024; MetaCPAN )
Mojolicious-Plugin-AssetPack/lib/Mojolicious/Plugin/AssetPack/Asset.pm ( view source; MetaCPAN )
n undef;
}

sub size { $_[0]->_asset->size }

sub url_for { $_[1]->url_for(assetpack => $_[0]->TO_JSON); }

sub _default_tag_for {
  my ($asset, $c, $args, @attrs) = @_;
  my $url      = $asset->url_f
rl"), @attrs);
}

sub FROM_JSON {
  my ($self, $attrs) = @_;
  $self->$_($attrs->{$_}) for grep { defined $attrs->{$_} } qw(checksum format minified);
  $self;
}

sub TO_JSON {
  return {map { ($_ => 
OM_JSON

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

The opposite of L</TO_JSON>. Will set the read/write L</ATTRIBUTES> from the
values in C<$hash_ref>.

=head2 TO_JSON

  $hash_ref = $self->FROM_JSON;


Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.