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-face removal, 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 the CSS::Minifier::Plugin role; 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.

CSS::Minifier v0.0.14

CSS Minifier

Authors

  • Sasha Abbott

License

CC0-1.0

Dependencies

Test Dependencies

Provides

  • CSS::Minifier
  • CSS::Minifier::Document
  • CSS::Minifier::Normalizer
  • CSS::Minifier::Parser
  • CSS::Minifier::Pipeline
  • CSS::Minifier::Plugin
  • CSS::Minifier::Plugin::Dedup
  • CSS::Minifier::Plugin::Merging
  • CSS::Minifier::Util
  • CSS::Minifier::Writer

The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.