README.chromium
1 Short Name: rJSmin
2 URL: http://opensource.perlig.de/rjsmin/
3 Version: 1.0.10
4 License: Apache 2.0
5 License File: NOT_SHIPPED
6 Security Critical: no
7
8 Description:
9 rJSmin is a javascript minifier written in python.
10 The minifier is based on the semantics of jsmin.c by Douglas Crockford.
11 The module is a re-implementation aiming for speed, so it can be used at runtime (rather than during a preprocessing step). Usually it produces the same results as the original jsmin.c.
12
13 Modifications made:
14 - Removed the bench.sh since the file doesn't have the licensing info and
15 caused license checker to fail.
16
README.rst
1 .. -*- coding: utf-8 -*-
2
3 ===========================================
4 rJSmin - A Javascript Minifier For Python
5 ===========================================
6
7 TABLE OF CONTENTS
8 -----------------
9
10 1. Introduction
11 2. Copyright and License
12 3. System Requirements
13 4. Installation
14 5. Documentation
15 6. Bugs
16 7. Author Information
17
18
19 INTRODUCTION
20 ------------
21
22 rJSmin is a javascript minifier written in python.
23
24 The minifier is based on the semantics of `jsmin.c by Douglas Crockford`_\.
25
26 The module is a re-implementation aiming for speed, so it can be used at
27 runtime (rather than during a preprocessing step). Usually it produces the
28 same results as the original ``jsmin.c``. It differs in the following ways:
29
30 - there is no error detection: unterminated string, regex and comment
31 literals are treated as regular javascript code and minified as such.
32 - Control characters inside string and regex literals are left untouched; they
33 are not converted to spaces (nor to \\n)
34 - Newline characters are not allowed inside string and regex literals, except
35 for line continuations in string literals (ECMA-5).
36 - "return /regex/" is recognized correctly.
37 - "+ +" and "- -" sequences are not collapsed to '++' or '--'
38 - Newlines before ! operators are removed more sensibly
39 - Comments starting with an exclamation mark (``!``) can be kept optionally
40 - rJSmin does not handle streams, but only complete strings. (However, the
41 module provides a "streamy" interface).
42
43 Since most parts of the logic are handled by the regex engine it's way faster
44 than the original python port of ``jsmin.c`` by Baruch Even. The speed factor
45 varies between about 6 and 55 depending on input and python version (it gets
46 faster the more compressed the input already is). Compared to the
47 speed-refactored python port by Dave St.Germain the performance gain is less
48 dramatic but still between 3 and 50 (for huge inputs). See the docs/BENCHMARKS
49 file for details.
50
51 rjsmin.c is a reimplementation of rjsmin.py in C and speeds it up even more.
52
53 .. _jsmin.c by Douglas Crockford: http://www.crockford.com/javascript/jsmin.c
54
55
56 COPYRIGHT AND LICENSE
57 ---------------------
58
59 Copyright 2011 - 2014
60 Andr Malo or his licensors, as applicable.
61
62 The whole package (except for the files in the bench/ directory)
63 is distributed under the Apache License Version 2.0. You'll find a copy in the
64 root directory of the distribution or online at:
65 <http://www.apache.org/licenses/LICENSE-2.0>.
66
67
68 SYSTEM REQUIREMENTS
69 -------------------
70
71 Both python 2 (>=2.4) and python 3 are supported.
72
73
74 INSTALLATION
75 ------------
76
77 Using pip
78 ~~~~~~~~~
79
80 $ pip install rjsmin
81
82
83 Using distutils
84 ~~~~~~~~~~~~~~~
85
86 $ python setup.py install
87
88 The following extra options to the install command may be of interest:
89
90 --without-c-extensions Don't install C extensions
91 --without-docs Do not install documentation files
92
93
94 Drop-in
95 ~~~~~~~
96
97 rJSmin effectively consists of two files: rjsmin.py and rjsmin.c, the
98 latter being entirely optional. So, for simple integration you can just
99 copy rjsmin.py into your project and use it.
100
101
102 DOCUMENTATION
103 -------------
104
105 A generated API documentation is available in the docs/apidoc/ directory.
106 But you can just look into the module. It provides a simple function,
107 called jsmin which takes the script as a string and returns the minified
108 script as a string.
109
110 The module additionally provides a "streamy" interface similar to the one
111 jsmin.c provides:
112
113 $ python -mrjsmin <script >minified
114
115 It takes two options:
116
117 -b Keep bang-comments (Comments starting with an exclamation mark)
118 -p Force using the python implementation (not the C implementation)
119
120 The latest documentation is also available online at
121 <http://opensource.perlig.de/rjsmin/>.
122
123
124 BUGS
125 ----
126
127 No bugs, of course. ;-)
128 But if you've found one or have an idea how to improve rjsmin, feel free
129 to send a pull request on `github <https://github.com/ndparker/rjsmin>`_
130 or send a mail to <rjsmin-bugs (a] perlig.de>.
131
132
133 AUTHOR INFORMATION
134 ------------------
135
136 Andr "nd" Malo <nd (a] perlig.de>
137 GPG: 0x8103A37E
138
139
140 If God intended people to be naked, they would be born that way.
141 -- Oscar Wilde
142