| 1 |
NAME |
| 2 |
CSS::Squish - Compact many CSS files into one big file |
| 3 |
|
| 4 |
SYNOPSIS |
| 5 |
use CSS::Squish; |
| 6 |
my $concatenated = CSS::Squish->concatenate(@files); |
| 7 |
|
| 8 |
DESCRIPTION |
| 9 |
This module takes a list of CSS files and concatenates them, making sure |
| 10 |
to honor any valid @import statements included in the files. |
| 11 |
|
| 12 |
Following the CSS 2.1 spec, @import statements must be the first rules |
| 13 |
in a CSS file. Media-specific @import statements will be honored by |
| 14 |
enclosing the included file in an @media rule. This has the side effect |
| 15 |
of actually *improving* compatibility in Internet Explorer, which |
| 16 |
ignores media-specific @import rules but understands @media rules. |
| 17 |
|
| 18 |
It is possible that feature versions will include methods to compact |
| 19 |
whitespace and other parts of the CSS itself, but this functionality is |
| 20 |
not supported at the current time. |
| 21 |
|
| 22 |
METHODS |
| 23 |
CSS::Squish->concatenate(@files) |
| 24 |
Takes a list of files to concatenate and returns the results as one big |
| 25 |
scalar. |
| 26 |
|
| 27 |
CSS::Squish->concatenate_to($dest, @files) |
| 28 |
Takes a filehandle to print to and a list of files to concatenate. |
| 29 |
"concatenate" uses this method with an "open"ed scalar. |
| 30 |
|
| 31 |
CSS::Squish->roots(@dirs) |
| 32 |
A getter/setter for additional paths to search when looking for imported |
| 33 |
files. The paths specified here are searched _before_ trying to find the |
| 34 |
import relative to the file from which it is imported. This is useful if |
| 35 |
your server has multiple document roots from which your CSS imports |
| 36 |
files and lets you override the default behaviour (but still fall back |
| 37 |
to it). |
| 38 |
|
| 39 |
BUGS AND SHORTCOMINGS |
| 40 |
At the current time, comments are not skipped. This means comments |
| 41 |
happening before @import statements at the top of a file will cause the |
| 42 |
@import rules to not be parsed. Make sure the @import rules are the very |
| 43 |
first thing in the file (and only one per line). |
| 44 |
|
| 45 |
Only direct @import loops (i.e. where a file imports itself) are checked |
| 46 |
and skipped. It's easy enough to get this module in a loop. Don't do it. |
| 47 |
|
| 48 |
As of now, server-relative URLs (instead of file-relative URLs) will not |
| 49 |
work correctly. |
| 50 |
|
| 51 |
All other bugs should be reported via |
| 52 |
<http://rt.cpan.org/Public/Dist/Display.html?Name=CSS-Squish> or |
| 53 |
[email protected]. |
| 54 |
|
| 55 |
AUTHOR |
| 56 |
Thomas Sibley <[email protected]> |
| 57 |
|
| 58 |
COPYRIGHT AND LICENSE |
| 59 |
Copyright (c) 2006. |
| 60 |
|
| 61 |
This library is free software; you can redistribute it and/or modify it |
| 62 |
under the same terms as Perl itself, either Perl version 5.8.3 or, at |
| 63 |
your option, any later version of Perl 5 you may have available. |
| 64 |
|