=head1 NAME Mojolicious::Plugin::StaticCompressor - Automatic JS/CSS minifier & compressor for Mojolicious =head1 SYNOPSIS Into the your Mojolicious application: sub startup { my $self = shift; $self->plugin('StaticCompressor'); ~~~ (Also, you can read the examples using the Mojolicious::Lite, in a later section.) Then, into the template in your application:
~~~~ <%= js '/foo.js', '/bar.js' %> <%= css '/baz.css' %> ~~~~ However, this module has just launched development yet. please give me your feedback. =head1 DISCRIPTION This Mojolicious plugin is minifier and compressor for static JavaScript file (.js) and CSS file (.css). =head1 INSTALLATION (from GitHub) $ git clone git://github.com/mugifly/p5-Mojolicious-Plugin-StaticCompressor.git $ cpanm ./p5-Mojolicious-Plugin-StaticCompressor =head1 HELPERS You can use these helpers on templates and others. =head2 js $file_path [, ...] Example of use on template file: <%= js '/js/foo.js' %> This is just available as substitution for the 'javascript' helper (built-in helper of Mojolicious). However, this helper will output a HTML-tag including the URL which is a compressed files. When this script file has output (just received a request), it is minified automatically. Then, minified file are cached in the memory. =head3 Support for multiple files In addition, You can also use this helper with multiple js-files: <%= js '/js/foo.js', '/js/bar.js' %> In this case, this helper will output a single HTML-tag. but, when these file has output, these are combined (and minified) automatically. =head2 css $file_path [, ...] This is just available as substitution for the 'stylesheet' helper (built-in helper of Mojolicious). =head2 js_nominify $file_path [, ...] If you don't want Minify, please use this. This helper is available for purposes that only combine with multiple js-files. =head2 css_nominify $file_path [, ...] If you don't want Minify, please use this. This helper is available for purposes that only combine with multiple css-files. =head1 CONFIGURATION =head2 disable_on_devmode You can disable a combine (and minify) when running your Mojolicious application as 'development' mode (such as a running on the 'morbo'), by using this option: $self->plugin('StaticCompressor', disable_on_devmode => 1); (default: 0) =head1 KNOWN ISSUES =over 4 =item * Implement the disk cache. (Currently is memory cache only.) =item * Improvement of the load latency in the first. =item * Support for LESS and Sass. =back Your feedback is highly appreciated! https://github.com/mugifly/p5-Mojolicious-Plugin-StaticCompressor/issues =head1 EXAMPLE OF USE Prepared a brief sample app for you, with using Mojolicious::Lite: example/example.pl $ morbo example.pl Let's access to http://localhost:3000/ with your browser. =head1 SEE ALSO L