Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Plack middleware for serving resource that is concatnated some static files
Perl Other
tree: fe1524b30c

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib/Plack/Middleware
t
xt
.gitignore
.shipit
Changes
MANIFEST
MANIFEST.SKIP
Makefile.PL
README
env

README

NAME
    Plack::Middleware::StaticShared - concat some static files to one
    resource

SYNOPSIS
      use Plack::Builder;
      use WebService::Google::Closure;

      builder {
          enable "StaticShared",
              cache => Cache::Memcached::Fast->new(servers => [qw/192.168.0.11:11211/]),
              base  => './static/',
              binds => [
                  {
                      prefix       => '/.shared.js',
                      content_type => 'text/javascript; charset=utf8',
                      filter       => sub {
                          WebService::Google::Closure->new(js_code => $_)->compile->code;
                      }
                  },
                  {
                      prefix       => '/.shared.css',
                      content_type => 'text/css; charset=utf8',
                  }
              ];
              verifier => sub {
                  my ($version, $prefix) = @_;
                  $version =~ /v\d/
              },

          $app;
      };

    And concatnated resources are provided as like following:

      /.shared.js:v1:/js/foolib.js,/js/barlib.js,/js/app.js
          => concat following: ./static/js/foolib.js, ./static/js/barlib.js, ./static/js/app.js

DESCRIPTION
    Plack::Middleware::StaticShared provides resource end point which concat
    some static files to one resource for reducing http requests.

CONFIGURATIONS
    cache (required)
        A cache object for caching concatnated resource content.

    base (required)
        Base directory which concatnating resource located in.

    binds (required)
        Definition of concatnated resources.

    verifier (optional)
        A subroutine for verifying version string to avoid attacking of
        cache flooding.

AUTHOR
    cho45

SEE ALSO
    Plack::Middleware Plack::Builder

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

Something went wrong with that request. Please try again.