Skip to content

Commit 4e4511e

Browse files
committed
Switch to Dist::Zilla for release management.
1 parent 75f3df8 commit 4e4511e

12 files changed

+128
-255
lines changed

Build.PL

-69
This file was deleted.

Changes

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
Revision history for Perl extension Apache2::Filter::Minifier::JavaScript.
22

3+
{{$NEXT}}
4+
- Switch to Dist::Zilla for release management
5+
36
1.06 Fri Nov 7 17:05 PST 2014
47
- Update tests to accommodate Apache-2.4.x series
58

MANIFEST

-32
This file was deleted.

MANIFEST.SKIP

-5
This file was deleted.

META.json

-52
This file was deleted.

META.yml

-29
This file was deleted.

Makefile.PL

-56
This file was deleted.

README.md

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# NAME
2+
3+
Apache2::Filter::Minifier::JavaScript - JS minifying output filter
4+
5+
# SYNOPSIS
6+
7+
```perl
8+
<LocationMatch "\.js$">
9+
PerlOutputFilterHandler Apache2::Filter::Minifier::JavaScript
10+
11+
# if you need to supplement MIME-Type list
12+
PerlSetVar JsMimeType text/json
13+
14+
# if you want to explicitly specify the minifier to use
15+
#PerlSetVar JsMinifier JavaScript::Minifier::XS
16+
#PerlSetVar JsMinifier JavaScript::Minifier
17+
#PerlSetVar JsMinifier MY::Minifier::function
18+
</LocationMatch>
19+
```
20+
21+
# DESCRIPTION
22+
23+
`Apache2::Filter::Minifier::JavaScript` is a Mod\_perl2 output filter which
24+
minifies JavaScript using `JavaScript::Minifier` or
25+
`JavaScript::Minifier::XS`.
26+
27+
Only JavaScript documents are minified, all others are passed through
28+
unaltered. `Apache2::Filter::Minifier::JavaScript` comes with a list of
29+
several known acceptable MIME-Types for JavaScript documents, but you can
30+
supplement that list yourself by setting the `JsMimeType` PerlVar
31+
appropriately (use `PerlSetVar` for a single new MIME-Type, or `PerlAddVar`
32+
when you want to add multiple MIME-Types).
33+
34+
Given a choice, using `JavaScript::Minifier::XS` is preferred over
35+
`JavaScript::Minifier`, but we'll use whichever one you've got available. If
36+
you want to explicitly specify which minifier you want to use, set the
37+
`JsMinifier` PerlVar to the name of the package/function that implements the
38+
minifier. Minification functions are expected to accept a single parameter
39+
(the JavaScript to be minified) and to return the minified JavaScript on
40+
completion. If you specify a package name, we look for a `minify()` function
41+
in that package.
42+
43+
## Caching
44+
45+
Minification does require additional CPU resources, and it is recommended that
46+
you use some sort of cache in order to keep this to a minimum.
47+
48+
Being that you're already running Apache2, though, here's some examples of a
49+
mod\_cache setup:
50+
51+
Disk Cache
52+
53+
```
54+
# Cache root directory
55+
CacheRoot /path/to/your/disk/cache
56+
# Enable cache for "/js/" location
57+
CacheEnable disk /js/
58+
```
59+
60+
Memory Cache
61+
62+
```
63+
# Cache size: 4 MBytes
64+
MCacheSize 4096
65+
# Min object size: 128 Bytes
66+
MCacheMinObjectSize 128
67+
# Max object size: 512 KBytes
68+
MCacheMaxObjectSize 524288
69+
# Enable cache for "/js/" location
70+
CacheEnable mem /js/
71+
```
72+
73+
# METHODS
74+
75+
- handler($filter)
76+
77+
JavaScript minification output filter.
78+
79+
# AUTHOR
80+
81+
Graham TerMarsch (cpan@howlingfrog.com)
82+
83+
Many thanks to Geoffrey Young for writing `Apache::Clean`, from which several
84+
things were lifted. :)
85+
86+
# COPYRIGHT
87+
88+
Copyright (C) 2007, Graham TerMarsch. All Rights Reserved.
89+
90+
This is free software; you can redistribute it and/or modify it under the same
91+
license as Perl itself.
92+
93+
# SEE ALSO
94+
95+
[JavaScript::Minifier](https://metacpan.org/pod/JavaScript%3A%3AMinifier),
96+
[JavaScript::Minifier::XS](https://metacpan.org/pod/JavaScript%3A%3AMinifier%3A%3AXS),
97+
[Apache2::Filter::Minifier::CSS](https://metacpan.org/pod/Apache2%3A%3AFilter%3A%3AMinifier%3A%3ACSS),
98+
[Apache::Clean](https://metacpan.org/pod/Apache%3A%3AClean).

README.txt

-12
This file was deleted.

cpanfile

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
requires 'perl', '>= 5.008001';
2+
requires 'JavaScript::Minifier';
3+
requires 'Apache2::Const';
4+
requires 'Apache2::Filter';
5+
requires 'Apache2::Log';
6+
requires 'Apache2::RequestRec';
7+
requires 'Apache2::RequestUtil';
8+
requires 'APR::Table';
9+
10+
recommends 'JavaScript::Minifier::XS';
11+
12+
test_requires 'Apache::Test', '>= 1.12';
13+
test_requires 'File::Slurp';
14+
test_requires 'Test::More', '>= 0.96';

dist.ini

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name = Apache2-Filter-Minifier-JavaScript
2+
author = Graham TerMarsch <[email protected]>
3+
license = Perl_5
4+
copyright_holder = Graham TerMarsch
5+
6+
[@Author::GTERMARS]
7+
-remove = MakeMaker
8+
[@ApacheTest]

t/TEST.PL

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
use strict;
2+
use warnings FATAL => 'all';
3+
use lib qw(lib);
4+
use Apache::TestRunPerl ();
5+
Apache::TestRunPerl->new->run(@ARGV);

0 commit comments

Comments
 (0)