Minifier
NAME
CSS::Minifier ā CSS minification library
SYNOPSIS
use CSS::Minifier;
my $min = CSS::Minifier.minify($css, :level(2));
DESCRIPTION
CSS::Minifier produces smaller CSS through value normalization,
color shortening, shorthand consolidation, and structural
deduplication/merging.
Two optimization levels are available:
Level 1 ā safe normalizations (color shortening, font-weight normalization, zero-unit removal, quote normalization, comment removal, shorthand consolidation)
Level 2 ā structural optimizations (duplicate ruleset and
@font-faceremoval, same-selector ruleset merging, same-declaration selector combination)
Shorthand consolidation covers margin, padding, border,
border-{top,right,bottom,left}, outline, list-style,
background (single and multi-layer), and font.
Custom properties (--*) are preserved verbatim and not
deduplicated.
Options
:$levelā optimization level (1 or 2, default 2):$verboseā log plugin names to stderr:$preserve-licensesā keep/*! */license comments:$color-masksā hex color shortening (default True):$color-namesā convert hex to named colors (default False):@extra-pluginsā additional plugin objects implementing theCSS::Minifier::Pluginrole; they run before the built-in Dedup and Merging plugins:$sepā separator between top-level statements (default '')
Environment
CSS_MINIFIER_CACHE_MAXā maximum internal character-array cache entries (default 500). Increase for large stylesheets to reduce repeated string scanning during parsing.
AUTHOR
Sasha Abbott <[email protected]>
COPYRIGHT AND LICENSE
This library is free software; you can redistribute it and/or modify it under CC0.