CSS::Packer(3pm)

πŸ“¦
version 2.09 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’… CSS::Packer β€” bestie edition

okay so you want to squish CSS?? say less. this is CSS::Packer, a Perl module (lives in the User Contributed Perl Documentation section of your man pages, iykyk) and it is literally Another CSS minifier. that's the whole name, no notes.


✨ VERSION ✨

Version 2.09 πŸŽ€ β€” that's the one you're reading about rn.


🌸 DESCRIPTION 🌸

it's a fast pure Perl CSS minifier. that's it, that's the description. fast. pure Perl. minifies. slay πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the whole vibe:

use CSS::Packer;

my $packer = CSS::Packer->init();

$packer->minify( $scalarref, $opts );

and if you want to get a scalar back without touching the input, just do this (like, e.g. example 2):

my $ret = $packer->minify( $scalarref, $opts );

also, for backward compatibility, you can still call minify like a plain old function, no object needed:

CSS::Packer::minify( $scalarref, $opts );

the rules, bestie: the first argument must be a scalarref of CSS code. the second argument must be a hashref of options. and here are the possible options πŸ‘‡

  • compress β€” sets the compression level. possible values are 'minify' and 'pretty'. default is 'pretty'. 🫢

'pretty' turns

a {
color:          black
;}   div

{ width:100px;
}

into

a{
color:black;
}
div{
width:100px;
}

and 'minify' takes those same rules and gives you this:

a{color:black;}div{width:100px;}
  • indent β€” how many spaces to use for indentation. only actually used when compress is 'pretty'. default is 0. ✨
  • copyright β€” lets you drop a copyright notice at the top of the script. πŸ’–
  • remove_copyright β€” if there's a copyright notice chilling in a comment, it only gets removed if this option is set to a true value. otherwise, the first comment containing the word "copyright" gets added at the top of the packed script. also, a copyright comment will be overwritten by a copyright notice you define with the copyright option. 😭
  • no_compress_comment β€” if this is not set to a true value, you're allowed to set a CSS comment that stops the input from being packed, or that defines a compression level. like so:
/* CSS::Packer _no_compress_ */
/* CSS::Packer pretty */

πŸ‘‘ AUTHOR πŸ‘‘

Merten Falk, "<nevesenin at cpan.org>". now maintained by Lee Johnson (LEEJO). 🫢


πŸ’€ BUGS πŸ’€

please report any bugs or feature requests through the web interface at <http://github.com/leejo/css-packer-perl/issues>. they'll be notified, and then you'll automatically be notified of progress on your bug as changes get made. the circle of life fr fr 🌈


πŸŽ€ SUPPORT πŸŽ€

you can find documentation for this module with the perldoc command.

perldoc CSS::Packer

Copyright 2008 - 2011 Merten Falk, all rights reserved.

this program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


πŸ”₯ SEE ALSO πŸ”₯

  • CSS::Minifier
  • CSS::Minifier::XS

πŸ’œ that's the whole page bestie, go forth and minify. no cap.

this was pulled from perl v5.38.2, dated 2024-03-05, straight out of CSS::Packer(3pm) β€” so if your version looks different, that's why, mwah πŸ’…βœ¨

πŸ“¦ where this page comes from