]>
Raphaël G. Git Repositories - binary/blob - cpack
8 use POSIX
qw(EXIT_SUCCESS EXIT_FAILURE);
14 my $compress = 'pretty';
17 @ARGV = map { if ($_ eq '-p' || $_ eq '--pretty') { $compress = 'pretty'; (); } elsif ($_ eq '-m' || $_ eq '--minify') { $compress = 'minify'; (); } else { $_; } } @ARGV;
19 # Show usage with invalid argument or stdin opened to a tty
20 if (scalar(@ARGV) || -t STDIN
) {
21 print "Usage: $0 [-p|--pretty|-m|--minify] < input.css > output.css\n";
25 # Instantiate packer object
26 my $packer = CSS
::Packer-
>init();
28 # Load input in variable
29 my $input = do { local $/; <STDIN
> };
31 # Minify input with required compression
32 $packer->minify(\
$input, compress
=> $compress);
44 Cpack - A simple perl CSS minifier
52 A fast pure Perl CSS minifier script.
56 Raphaël Gertz (Rapsys) << <git at rapsys.eu> >>.
58 =head1 COPYRIGHT & LICENSE
60 Copyright 2016 - 2017 Raphaël Gertz, all rights reserved.
62 This program is free software: you can redistribute it and/or modify
63 it under the terms of the GNU General Public License as published by
64 the Free Software Foundation, either version 3 of the License, or
65 (at your option) any later version.
67 This program is distributed in the hope that it will be useful,
68 but WITHOUT ANY WARRANTY; without even the implied warranty of
69 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
70 GNU General Public License for more details.
72 You should have received a copy of the GNU General Public License
73 along with this program. If not, see <http://www.gnu.org/licenses/>.