Catalyst::View::JavaScript - Cache and/or compress JavaScript output


Catalyst-View-JavaScript documentation  | view source Contained in the Catalyst-View-JavaScript distribution.

Index


NAME

Top

Catalyst::View::JavaScript - Cache and/or compress JavaScript output

VERSION

Top

version 0.995

SYNOPSIS

Top

This module fetches JavaScript either from the stash or from $c->output. By default the JavaScript code is read from $c->stash->{js} and compressed. The content type is set to text/javascript.

By default this view will not compress and/or cache if your application is in the debug mode.

METHODS

Top

cache

If $c is able to cache (i. e. if $c->can('cache')) the value of cache is used as key to cache the JavaScript output. This method returns the view so you can invoke it like this:

  $c->detach( $c->view('JavaScript')->cache('unique-cache-key') );

compress

Set this to a true value to enable compression of the code. See JavaScript::Minifier::XS for more information on how this minification works. Defaults to 1.

disable_if_debug

If you set the debug flag on your application caching and compressing is disabled. Defaults to 1.

output

If this is set to a true value this module fetches the JavaScript code from $c->output and ignores the value of stash. Defaults to 0.

key

This module looks in the stash for this value for JavaScript if stash is enabled. Defaults to js.

stash

Set this to a true value if the JavaScript code is on the stash. Set the stash value with key. Defaults to 1.

AUTHOR

Top

Moritz Onken, <onken at netcubed.de>

BUGS

Top

Please report any bugs or feature requests to bug-catalyst-view-javascript at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-View-JavaScript. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT & LICENSE

Top


Catalyst-View-JavaScript documentation  | view source Contained in the Catalyst-View-JavaScript distribution.