From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

NAME

Plack::Middleware::Static::Minifier - serves static files and minify CSS and JavaScript

SYNOPSIS

builder {
enable "Plack::Middleware::Static::Minifier",
path => qr{^/(js|css|images)/},
root => './htdocs/';
$app;
};

or you can cache minified content

my $cache = Cache::FileCache->new(+{
cache_root => '/tmp/foo',
namespace => 'namespace',
default_expires_in => 60*60*24*7,
});
builder {
enable "Plack::Middleware::Static::Minifier",
path => qr{^/(js|css|images)/},
root => './htdocs/',
cache => $cache;
$app;
};

Also you can stop minifying by no_minify option

builder {
enable "Plack::Middleware::Static::Minifier",
path => qr{^/(js|css|images)/},
root => './htdocs/',
no_minify => $env_is_dev;
$app;
};

DESCRIPTION

Plack::Middleware::Static::Minifier serves static files with Plack and minify CSS and JavaScript. This module is the subclass of Plack::Middleware::Static.

See Plack::Middleware::Static for more detail.

METHOD

call

REPOSITORY

Plack::Middleware::Static::Minifier is hosted on github <http://github.com/bayashi/Plack-Middleware-Static-Minifier>

AUTHOR

Dai Okabayashi <bayashi@cpan.org>

SEE ALSO

Plack::Middleware::Static, CSS::Minifier::XS, JavaScript::Minifier::XS Plack::Middleware, Plack

LICENSE

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.