Debian Codegraph @

docs/DESCRIPTION

raw
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 - More characters are allowed before regexes.
21 - Line terminators after regex literals are handled more sensibly
22 - "+ +" and "- -" sequences are not collapsed to '++' or '--'
23 - Newlines before ! operators are removed more sensibly
24 - (Unnested) template literals are supported (ECMA-6)
25 - Comments starting with an exclamation mark (``!``) can be kept optionally
26 - rJSmin does not handle streams, but only complete strings. (However, the
27 module provides a "streamy" interface).
28
29 Since most parts of the logic are handled by the regex engine it's way faster
30 than the original python port of ``jsmin.c`` by Baruch Even. The speed factor
31 varies between about 6 and 55 depending on input and python version (it gets
32 faster the more compressed the input already is). Compared to the
33 speed-refactored python port by Dave St.Germain the performance gain is less
34 dramatic but still between 3 and 50 (for huge inputs)). See the
35 docs/BENCHMARKS file for details.
36
37 rjsmin.c is a reimplementation of rjsmin.py in C and speeds it up even more.
38
39 Supported python versions are 2.7 and 3.6+.
40
41 .. _jsmin.c by Douglas Crockford: http://www.crockford.com/javascript/jsmin.c
42
43
44 Copyright and License
45 ~~~~~~~~~~~~~~~~~~~~~
46
47 Copyright 2011 - 2025
48 André Malo or his licensors, as applicable.
49
50 The whole package (except for the files in the bench/ directory) is
51 distributed under the Apache License Version 2.0. You'll find a copy in the
52 root directory of the distribution or online at:
53 <http://www.apache.org/licenses/LICENSE-2.0>.
54
55
56 Bugs
57 ~~~~
58
59 No bugs, of course. ;-)
60 But if you've found one or have an idea how to improve rjsmin, feel free
61 to send a pull request on `github <https://github.com/ndparker/rjsmin>`_
62 or send a mail to <[email protected]>.
63
64
65 Author Information
66 ~~~~~~~~~~~~~~~~~~
67
68 André "nd" Malo <nd perlig.de>
69 GPG: 0x029C942244325167
70
71
72 If God intended people to be naked, they would be born that way.
73 -- Oscar Wilde
74
75 .. vim:tw=72 syntax=rest