| 1 | use strict; | ||
| 2 | use warnings; | ||
| 3 | |||
| 4 | package Jifty::Script::WriteCCJS; | ||
| 5 | |||
| 6 | use base qw/Jifty::Script/; | ||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | Jifty::Script::WriteCCJS | ||
| 11 | |||
| 12 | =head1 SYNOPSIS | ||
| 13 | |||
| 14 | =head1 DESCRIPTION | ||
| 15 | |||
| 16 | =head2 options | ||
| 17 | |||
| 18 | Takes no options. | ||
| 19 | |||
| 20 | =head2 run | ||
| 21 | |||
| 22 | =cut | ||
| 23 | |||
| 24 | sub run { | ||
| 25 | my $self = shift; | ||
| 26 | Jifty->new; | ||
| 27 | |||
| 28 | my ($ccjs) = Jifty->find_plugin('Jifty::Plugin::CompressedCSSandJS'); | ||
| 29 | |||
| 30 | die "CompressedCSSandJS is not enabled for @{[Jifty->app_class]}\n" | ||
| 31 | unless $ccjs; | ||
| 32 | |||
| 33 | die "External generation is not enabled\n" | ||
| 34 | unless $ccjs->external_publish; | ||
| 35 | |||
| 36 | $ccjs->generate_css; | ||
| 37 | print "Wrote CSS to ".Jifty::CAS->key("ccjs","css-all").".css\n"; | ||
| 38 | $ccjs->generate_javascript; | ||
| 39 | print "Wrote JS to ".Jifty::CAS->key("ccjs","js-all").".js\n"; | ||
| 40 | } | ||
| 41 | |||
| 42 | =head1 SEE ALSO | ||
| 43 | |||
| 44 | L<Jifty::Plugin::CompressedCSSandJS> | ||
| 45 | |||
| 46 | =head1 COPYRIGHT AND LICENSE | ||
| 47 | |||
| 48 | Copyright 2010, Best Practical Solutions. | ||
| 49 | |||
| 50 | This is free software and may be modified and distributed under the same terms as Perl itself. | ||
| 51 | |||
| 52 | =cut | ||
| 53 | |||
| 54 | 1; |