1 ============== 2 CSS Minifier 3 ============== 4 5 RCSSmin is a CSS minifier. 6 7 The minifier is based on the semantics of the `YUI compressor`_\, which itself 8 is based on `the rule list by Isaac Schlueter`_\. 9 10 This module is a re-implementation aiming for speed instead of maximum 11 compression, so it can be used at runtime (rather than during a preprocessing 12 step). RCSSmin does syntactical compression only (removing spaces, comments 13 and possibly semicolons). It does not provide semantic compression (like 14 removing empty blocks, collapsing redundant properties etc). It does, however, 15 support various CSS hacks (by keeping them working as intended). 16 17 Here's a feature list: 18 19 - Strings are kept, except that escaped newlines are stripped 20 - Space/Comments before the very end or before various characters are 21 stripped: ``:{});=>+],!`` (The colon (``:``) is a special case, a single 22 space is kept if it's outside a ruleset.) 23 - Space/Comments at the very beginning or after various characters are 24 stripped: ``{}(=:>+[,!`` 25 - Optional space after unicode escapes is kept, resp. replaced by a simple 26 space 27 - whitespaces inside ``url()`` definitions are stripped 28 - Comments starting with an exclamation mark (``!``) can be kept optionally. 29 - All other comments and/or whitespace characters are replaced by a single 30 space. 31 - Multiple consecutive semicolons are reduced to one 32 - The last semicolon within a ruleset is stripped 33 - CSS Hacks supported: 34 35 - IE7 hack (``>/**/``) 36 - Mac-IE5 hack (``/*\*/.../**/``) 37 - The boxmodelhack is supported naturally because it relies on valid CSS2 38 strings 39 - Between ``:first-line`` and the following comma or curly brace a space is 40 inserted. (apparently it's needed for IE6) 41 - Same for ``:first-letter`` 42 43 rcssmin.c is a reimplementation of rcssmin.py in C and improves runtime up to 44 factor 100 or so (depending on the input). docs/BENCHMARKS in the source 45 distribution contains the details. 46 47 Both python 2 (>= 2.4) and python 3 are supported. 48 49 .. _YUI compressor: https://github.com/yui/yuicompressor/ 50 51 .. _the rule list by Isaac Schlueter: https://github.com/isaacs/cssmin/ 52 53 54 Copyright and License 55 ~~~~~~~~~~~~~~~~~~~~~ 56 57 Copyright 2011 - 2014 58 Andr Malo or his licensors, as applicable. 59 60 The whole package (except for the files in the bench/ directory) is 61 distributed under the Apache License Version 2.0. You'll find a copy in the 62 root directory of the distribution or online at: 63 <http://www.apache.org/licenses/LICENSE-2.0>. 64 65 66 Bugs 67 ~~~~ 68 69 No bugs, of course. ;-) 70 But if you've found one or have an idea how to improve rcssmin, feel free 71 to send a pull request on `github <https://github.com/ndparker/rcssmin>`_ 72 or send a mail to <rcssmin-bugs (a] perlig.de>. 73 74 75 Author Information 76 ~~~~~~~~~~~~~~~~~~ 77 78 Andr "nd" Malo <nd perlig.de> 79 GPG: 0x8103A37E 80 81 82 If God intended people to be naked, they would be born that way. 83 -- Oscar Wilde 84 85 .. vim:tw=72 syntax=rest 86