GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
CSS::Minifier(3) User Contributed Perl Documentation CSS::Minifier(3)

CSS::Minifier - Perl extension for minifying CSS

To minify a CSS file and have the output written directly to another file

  use CSS::Minifier qw(minify);
  open(INFILE, 'myStylesheet.css') or die;
  open(OUTFILE, 'myStylesheet.css') or die;
  minify(input => *INFILE, outfile => *OUTFILE);
  close(INFILE);
  close(OUTFILE);

To minify a CSS string literal. Note that by omitting the outfile parameter a the minified code is returned as a string.

  my minifiedCSS = minify(input => 'div {font-family: serif;}');

To include a copyright comment at the top of the minified code.

  minify(input => 'div {font-family: serif;}', copyright => 'BSD License');

The "input" parameter is manditory. The "output" and "copyright" parameters are optional and can be used in any combination.

This module removes unnecessary whitespace from CSS. The primary requirement developing this module is to not break working stylesheets: if working CSS is in input then working CSS is output. The Mac/Internet Explorer comment hack will be minimized but not stripped and so will continue to function.

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.

For static CSS 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.

None by default.

Exportable on demand: minifiy()

This project is developed using an SVN repository. To check out the repository svn co http://dev.michaux.ca/svn/random/CSS-Minifier

You may also be interested in the JavaScript::Minifier module also available on CPAN.

Peter Michaux, <petermichaux@gmail.com>

Copyright (C) 2007 by Peter Michaux

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.

2007-08-03 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.