• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

_setup/22-Nov-2023-3,9222,944

bench/22-Nov-2023-4,7884,314

docs/22-Nov-2023-2,3271,953

tests/22-Nov-2023-1,6251,348

LICENSED22-Nov-202311.1 KiB202169

MANIFESTD22-Nov-202310.5 KiB355354

PKG-INFOD22-Nov-202315.9 KiB317261

README.chromiumD22-Nov-2023470 1714

README.rstD22-Nov-20234.3 KiB154104

package.cfgD22-Nov-20231.6 KiB8568

rcssmin.cD22-Nov-202329 KiB1,164849

rcssmin.pyD22-Nov-202312.7 KiB375292

run_tests.pyD22-Nov-20235 KiB167130

setup.pyD22-Nov-20231.2 KiB4315

README.chromium

1Name: rCSSmin
2Short Name: rcssmin
3URL: http://opensource.perlig.de/rcssmin/
4Version: 1.0.5
5License: Apache 2.0
6License File: NOT_SHIPPED
7Security Critical: no
8
9Description:
10rCSSmin is a CSS minifier written in python.
11The minifier is based on the semantics of the YUI compressor, which itself is
12based on the rule list by Isaac Schlueter.
13
14Modifications made:
15 - Removed the bench.sh since the file doesn't have the licensing info and
16   caused license checker to fail.
17

README.rst

1.. -*- coding: utf-8 -*-
2
3=====================================
4 rCSSmin - A CSS Minifier For Python
5=====================================
6
7TABLE OF CONTENTS
8-----------------
9
101. Introduction
112. Copyright and License
123. System Requirements
134. Installation
145. Documentation
156. Bugs
167. Author Information
17
18
19INTRODUCTION
20------------
21
22RCSSmin is a CSS minifier written in python.
23
24The minifier is based on the semantics of the `YUI compressor`_\, which itself
25is based on `the rule list by Isaac Schlueter`_\.
26
27This module is a re-implementation aiming for speed instead of maximum
28compression, so it can be used at runtime (rather than during a preprocessing
29step). RCSSmin does syntactical compression only (removing spaces, comments
30and possibly semicolons). It does not provide semantic compression (like
31removing empty blocks, collapsing redundant properties etc). It does, however,
32support various CSS hacks (by keeping them working as intended).
33
34Here's a feature list:
35
36- Strings are kept, except that escaped newlines are stripped
37- Space/Comments before the very end or before various characters are
38  stripped: ``:{});=>+],!`` (The colon (``:``) is a special case, a single
39  space is kept if it's outside a ruleset.)
40- Space/Comments at the very beginning or after various characters are
41  stripped: ``{}(=:>+[,!``
42- Optional space after unicode escapes is kept, resp. replaced by a simple
43  space
44- whitespaces inside ``url()`` definitions are stripped
45- Comments starting with an exclamation mark (``!``) can be kept optionally.
46- All other comments and/or whitespace characters are replaced by a single
47  space.
48- Multiple consecutive semicolons are reduced to one
49- The last semicolon within a ruleset is stripped
50- CSS Hacks supported:
51
52  - IE7 hack (``>/**/``)
53  - Mac-IE5 hack (``/*\*/.../**/``)
54  - The boxmodelhack is supported naturally because it relies on valid CSS2
55    strings
56  - Between ``:first-line`` and the following comma or curly brace a space is
57    inserted. (apparently it's needed for IE6)
58  - Same for ``:first-letter``
59
60rcssmin.c is a reimplementation of rcssmin.py in C and improves runtime up to
61factor 100 or so (depending on the input). docs/BENCHMARKS in the source
62distribution contains the details.
63
64.. _YUI compressor: https://github.com/yui/yuicompressor/
65
66.. _the rule list by Isaac Schlueter: https://github.com/isaacs/cssmin/
67
68
69COPYRIGHT AND LICENSE
70---------------------
71
72Copyright 2011 - 2014
73André Malo or his licensors, as applicable.
74
75The whole package (except for the files in the bench/ directory)
76is distributed under the Apache License Version 2.0. You'll find a copy in the
77root directory of the distribution or online at:
78<http://www.apache.org/licenses/LICENSE-2.0>.
79
80
81SYSTEM REQUIREMENTS
82-------------------
83
84Both python 2 (>=2.4) and python 3 are supported.
85
86
87INSTALLATION
88------------
89
90Using pip
91~~~~~~~~~
92
93$ pip install rcssmin
94
95
96Using distutils
97~~~~~~~~~~~~~~~
98
99$ python setup.py install
100
101The following extra options to the install command may be of interest:
102
103   --without-c-extensions  Don't install C extensions
104   --without-docs          Do not install documentation files
105
106
107Drop-in
108~~~~~~~
109
110rCSSmin effectively consists of two files: rcssmin.py and rcssmin.c, the
111latter being entirely optional. So, for simple integration you can just
112copy rcssmin.py into your project and use it.
113
114
115DOCUMENTATION
116-------------
117
118A generated API documentation is available in the docs/apidoc/ directory.
119But you can just look into the module. It provides a simple function,
120called cssmin which takes the CSS as a string and returns the minified
121CSS as a string.
122
123The module additionally provides a "streamy" interface:
124
125$ python -mrcssmin <css >minified
126
127It takes two options:
128
129  -b  Keep bang-comments (Comments starting with an exclamation mark)
130  -p  Force using the python implementation (not the C implementation)
131
132The latest documentation is also available online at
133<http://opensource.perlig.de/rcssmin/>.
134
135
136BUGS
137----
138
139No bugs, of course. ;-)
140But if you've found one or have an idea how to improve rcssmin, feel free to
141send a pull request on `github <https://github.com/ndparker/rcssmin>`_ or
142send a mail to <rcssmin-bugs@perlig.de>.
143
144
145AUTHOR INFORMATION
146------------------
147
148André "nd" Malo <nd@perlig.de>
149GPG: 0x8103A37E
150
151
152  If God intended people to be naked, they would be born that way.
153                                                   -- Oscar Wilde
154