NAME

Catalyst::Plugin::AutoAssets - Plugin interface to Catalyst::Controller::AutoAssets

SYNOPSIS

use Catalyst;
with 'Catalyst::Plugin::AutoAssets';

# Inject/setup AutoAssets controllers: 
#  * MyApp::Controller::Assets::ExtJS   (/assets/extjs)
#  * MyApp::Controller::Assets::MyCSS   (/assets/mycss)
__PACKAGE__->config(
  name => 'MyApp',
  'Plugin::AutoAssets' => {
    assets => {
      'Assets::ExtJS' => {
        type => 'Directory',
        include => 'ext-3.4.0',
        persist_state => 1,
        sha1_string_length => 15
      },
      'Assets::MyCSS' => {
        type => 'CSS',
        include => '/path/to/css',
        minify => 1
      }
    }
  }
);

# Or, using arrayref syntax (if order is important):
__PACKAGE__->config(
  name => 'MyApp',
  'Plugin::AutoAssets' => {
    assets => [
      {
        controller => 'Assets::ExtJS',
        type => 'Directory',
        include => 'ext-3.4.0',
        persist_state => 1,
        sha1_string_length => 15
      },
      {
        controller => 'Assets::MyCSS',
        type => 'CSS',
        include => '/path/to/css',
        minify => 1
      },
      {
        controller => 'Assets::Icons',
        type => 'IconSet',
        include => 'root/static/icons'
      }
    ]
  }
);

Optionally, within .tt files:

<head>
  <!-- all html includes from all assets at once -->
  [% c.all_html_head_tags %]
</head>

DESCRIPTION

This class provides a simple Catalyst Plugin interface to Catalyst::Controller::AutoAssets for easy setup of multiple AutoAssets controllers via config. To use, simply pass a hashref (or arrayref) of 'assets' into the config key 'Plugin::AutoAssets' in your Catalyst application config. This hash should contain controller class names in the keys and Catalyst::Controller::AutoAssets hash configs in the values. Each controller will be injected into your application at runtime.

This is just a faster setup than creating the controller classes manually. See Catalyst::Controller::AutoAssets for details and supported config params.

CONFIG PARAMS

assets

HashRef or ArrayRef of Catalyst::Controller::AutoAssets configs. Defines the name of each controller to create and the config to use. In HashRef form, the Controller name is specified in the keys with hashref config values. ArrayRef form is a list of hashref configs with an extra key 'controller' to set the Controller name (removed from the config before being passed into the Controller).

See the SYNOPSIS above for examples of both.

METHODS

all_html_head_tags

Convenience method concats the output of html_head_tags() from all the AutoAssets controllers at once.

SEE ALSO

Catalyst::Controller::AutoAssets

AUTHOR

Henry Van Styn <vanstyn@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by IntelliTree Solutions llc.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.