OLD | NEW |
| (Empty) |
1 ===================== | |
2 Javascript Minifier | |
3 ===================== | |
4 | |
5 rJSmin is a javascript minifier written in python. | |
6 | |
7 The minifier is based on the semantics of `jsmin.c by Douglas Crockford`_\. | |
8 | |
9 The module is a re-implementation aiming for speed, so it can be used at | |
10 runtime (rather than during a preprocessing step). Usually it produces the | |
11 same results as the original ``jsmin.c``. It differs in the following ways: | |
12 | |
13 - there is no error detection: unterminated string, regex and comment | |
14 literals are treated as regular javascript code and minified as such. | |
15 - Control characters inside string and regex literals are left untouched; they | |
16 are not converted to spaces (nor to \n) | |
17 - Newline characters are not allowed inside string and regex literals, except | |
18 for line continuations in string literals (ECMA-5). | |
19 - "return /regex/" is recognized correctly. | |
20 - "+ +" and "- -" sequences are not collapsed to '++' or '--' | |
21 - Newlines before ! operators are removed more sensibly | |
22 - Comments starting with an exclamation mark (``!``) can be kept optionally | |
23 - rJSmin does not handle streams, but only complete strings. (However, the | |
24 module provides a "streamy" interface). | |
25 | |
26 Since most parts of the logic are handled by the regex engine it's way faster | |
27 than the original python port of ``jsmin.c`` by Baruch Even. The speed factor | |
28 varies between about 6 and 55 depending on input and python version (it gets | |
29 faster the more compressed the input already is). Compared to the | |
30 speed-refactored python port by Dave St.Germain the performance gain is less | |
31 dramatic but still between 3 and 50 (for huge inputs)). See the | |
32 docs/BENCHMARKS file for details. | |
33 | |
34 rjsmin.c is a reimplementation of rjsmin.py in C and speeds it up even more. | |
35 | |
36 Both python 2 (>=2.4) and python 3 are supported. | |
37 | |
38 .. _jsmin.c by Douglas Crockford: http://www.crockford.com/javascript/jsmin.c | |
39 | |
40 | |
41 Copyright and License | |
42 ~~~~~~~~~~~~~~~~~~~~~ | |
43 | |
44 Copyright 2011 - 2014 | |
45 André Malo or his licensors, as applicable. | |
46 | |
47 The whole package (except for the files in the bench/ directory) is | |
48 distributed under the Apache License Version 2.0. You'll find a copy in the | |
49 root directory of the distribution or online at: | |
50 <http://www.apache.org/licenses/LICENSE-2.0>. | |
51 | |
52 | |
53 Bugs | |
54 ~~~~ | |
55 | |
56 No bugs, of course. ;-) | |
57 But if you've found one or have an idea how to improve rjsmin, feel free | |
58 to send a pull request on `github <https://github.com/ndparker/rjsmin>`_ | |
59 or send a mail to <rjsmin-bugs@perlig.de>. | |
60 | |
61 | |
62 Author Information | |
63 ~~~~~~~~~~~~~~~~~~ | |
64 | |
65 André "nd" Malo <nd perlig.de> | |
66 GPG: 0x8103A37E | |
67 | |
68 | |
69 If God intended people to be naked, they would be born that way. | |
70 -- Oscar Wilde | |
71 | |
72 .. vim:tw=72 syntax=rest | |
OLD | NEW |