.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "CSS::Minifier 3pm" .TH CSS::Minifier 3pm "2022-11-30" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" CSS::Minifier \- Perl extension for minifying CSS .SH "SYNOPSIS" .IX Header "SYNOPSIS" To minify a \s-1CSS\s0 file and have the output written directly to another file .PP .Vb 6 \& use CSS::Minifier qw(minify); \& open(INFILE, \*(AqmyStylesheet.css\*(Aq) or die; \& open(OUTFILE, \*(AqmyStylesheet.css\*(Aq) or die; \& minify(input => *INFILE, outfile => *OUTFILE); \& close(INFILE); \& close(OUTFILE); .Ve .PP To minify a \s-1CSS\s0 string literal. Note that by omitting the outfile parameter a the minified code is returned as a string. .PP .Vb 1 \& my minifiedCSS = minify(input => \*(Aqdiv {font\-family: serif;}\*(Aq); .Ve .PP To include a copyright comment at the top of the minified code. .PP .Vb 1 \& minify(input => \*(Aqdiv {font\-family: serif;}\*(Aq, copyright => \*(AqBSD License\*(Aq); .Ve .PP The \*(L"input\*(R" parameter is manditory. The \*(L"output\*(R" and \*(L"copyright\*(R" parameters are optional and can be used in any combination. .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module removes unnecessary whitespace from \s-1CSS.\s0 The primary requirement developing this module is to not break working stylesheets: if working \s-1CSS\s0 is in input then working \s-1CSS\s0 is output. The Mac/Internet Explorer comment hack will be minimized but not stripped and so will continue to function. .PP This module understands space, horizontal tab, new line, carriage return, and form feed characters to be whitespace. Any other characters that may be considered whitespace are not minimized. These other characters include paragraph separator and vertical tab. .PP For static \s-1CSS\s0 files, it is recommended that you minify during the build stage of web deployment. If you minify on-the-fly then it might be a good idea to cache the minified file. Minifying static files on-the-fly repeatedly is wasteful. .SS "\s-1EXPORT\s0" .IX Subsection "EXPORT" None by default. .PP Exportable on demand: \fBminify()\fR .SH "SEE ALSO" .IX Header "SEE ALSO" This project is developed using an \s-1SVN\s0 repository. To check out the repository svn co http://dev.michaux.ca/svn/random/CSS\-Minifier .PP You may also be interested in the JavaScript::Minifier module also available on \s-1CPAN.\s0 .SH "AUTHORS" .IX Header "AUTHORS" Peter Michaux, .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2007 by Peter Michaux .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.