1CSS::Minifier(3)      User Contributed Perl Documentation     CSS::Minifier(3)
2
3
4

NAME

6       CSS::Minifier - Perl extension for minifying CSS
7

SYNOPSIS

9       To minify a CSS file and have the output written directly to another
10       file
11
12         use CSS::Minifier qw(minify);
13         open(INFILE, 'myStylesheet.css') or die;
14         open(OUTFILE, 'myStylesheet.css') or die;
15         minify(input => *INFILE, outfile => *OUTFILE);
16         close(INFILE);
17         close(OUTFILE);
18
19       To minify a CSS string literal. Note that by omitting the outfile
20       parameter a the minified code is returned as a string.
21
22         my minifiedCSS = minify(input => 'div {font-family: serif;}');
23
24       To include a copyright comment at the top of the minified code.
25
26         minify(input => 'div {font-family: serif;}', copyright => 'BSD License');
27
28       The "input" parameter is manditory. The "output" and "copyright"
29       parameters are optional and can be used in any combination.
30

DESCRIPTION

32       This module removes unnecessary whitespace from CSS. The primary
33       requirement developing this module is to not break working stylesheets:
34       if working CSS is in input then working CSS is output. The Mac/Internet
35       Explorer comment hack will be minimized but not stripped and so will
36       continue to function.
37
38       This module understands space, horizontal tab, new line, carriage
39       return, and form feed characters to be whitespace. Any other characters
40       that may be considered whitespace are not minimized. These other
41       characters include paragraph separator and vertical tab.
42
43       For static CSS files, it is recommended that you minify during the
44       build stage of web deployment. If you minify on-the-fly then it might
45       be a good idea to cache the minified file. Minifying static files on-
46       the-fly repeatedly is wasteful.
47
48   EXPORT
49       None by default.
50
51       Exportable on demand: minifiy()
52

SEE ALSO

54       This project is developed using an SVN repository. To check out the
55       repository svn co http://dev.michaux.ca/svn/random/CSS-Minifier
56
57       You may also be interested in the JavaScript::Minifier module also
58       available on CPAN.
59

AUTHORS

61       Peter Michaux, <petermichaux@gmail.com>
62
64       Copyright (C) 2007 by Peter Michaux
65
66       This library is free software; you can redistribute it and/or modify it
67       under the same terms as Perl itself, either Perl version 5.8.6 or, at
68       your option, any later version of Perl 5 you may have available.
69
70
71
72perl v5.32.0                      2020-07-28                  CSS::Minifier(3)
Impressum