wok view rcssmin/description.txt @ rev 19254

Up cookutils (803)
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sat Jul 02 23:48:55 2016 +0300 (2016-07-02)
parents
children
line source
1 RCSSmin is a CSS minifier written in Python.
3 The minifier is based on the semantics of the YUI compressor, which itself is
4 based on the rule list by Isaac Schlueter.
6 This module is a re-implementation aiming for speed instead of maximum
7 compression, so it can be used at runtime (rather than during a preprocessing
8 step). RCSSmin does syntactical compression only (removing spaces, comments and
9 possibly semicolons). It does not provide semantic compression (like removing
10 empty blocks, collapsing redundant properties etc). It does, however, support
11 various CSS hacks (by keeping them working as intended).
13 Here's a feature list:
15 - Strings are kept, except that escaped newlines are stripped
16 - Space/Comments before the very end or before various characters are
17 stripped: ``:{});=>],!`` (The colon (``:``) is a special case, a single
18 space is kept if it's outside a ruleset.)
19 - Space/Comments at the very beginning or after various characters are
20 stripped: ``{}(=:>[,!``
21 - Optional space after unicode escapes is kept, resp. replaced by a simple
22 space
23 - whitespaces inside ``url()`` definitions are stripped
24 - Comments starting with an exclamation mark (``!``) can be kept optionally.
25 - All other comments and/or whitespace characters are replaced by a single
26 space.
27 - Multiple consecutive semicolons are reduced to one
28 - The last semicolon within a ruleset is stripped
29 - CSS Hacks supported:
31 - IE7 hack (``>/**/``)
32 - Mac-IE5 hack (``/*\*/.../**/``)
33 - The boxmodelhack is supported naturally because it relies on valid CSS2
34 strings
35 - Between ``:first-line`` and the following comma or curly brace a space is
36 inserted. (apparently it's needed for IE6)
37 - Same for ``:first-letter``
39 rcssmin.c is a reimplementation of rcssmin.py in C and improves runtime up to
40 factor 100 or so (depending on the input). docs/BENCHMARKS in the source
41 distribution contains the details.
43 The module additionally provides a "streamy" interface:
45 $ python -mrcssmin <css >minified
47 It takes two options:
49 -b Keep bang-comments (Comments starting with an exclamation mark)
50 -p Force using the python implementation (not the C implementation)