Skip to main content

Javascript Minifier

Project description

rJSmin is a javascript minifier written in python.

The minifier is based on the semantics of jsmin.c by Douglas Crockford.

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. It differs in the following ways:

  • there is no error detection: unterminated string, regex and comment literals are treated as regular javascript code and minified as such.

  • Control characters inside string and regex literals are left untouched; they are not converted to spaces (nor to n)

  • Newline characters are not allowed inside string and regex literals, except for line continuations in string literals (ECMA-5).

  • “return /regex/” is recognized correctly.

  • More characters are allowed before regexes.

  • Line terminators after regex literals are handled more sensibly

  • “+ +” and “- -” sequences are not collapsed to ‘++’ or ‘–’

  • Newlines before ! operators are removed more sensibly

  • (Unnested) template literals are supported (ECMA-6)

  • Comments starting with an exclamation mark (!) can be kept optionally

  • rJSmin does not handle streams, but only complete strings. (However, the module provides a “streamy” interface).

Since most parts of the logic are handled by the regex engine it’s way faster than the original python port of jsmin.c by Baruch Even. The speed factor varies between about 6 and 55 depending on input and python version (it gets faster the more compressed the input already is). Compared to the speed-refactored python port by Dave St.Germain the performance gain is less dramatic but still between 3 and 50 (for huge inputs)). See the docs/BENCHMARKS file for details.

rjsmin.c is a reimplementation of rjsmin.py in C and speeds it up even more.

Supported python versions are 2.7 and 3.6+.

Bugs

No bugs, of course. ;-) But if you’ve found one or have an idea how to improve rjsmin, feel free to send a pull request on github or send a mail to <rjsmin-bugs@perlig.de>.

Author Information

André “nd” Malo <nd perlig.de> GPG: 0x029C942244325167

If God intended people to be naked, they would be born that way. – Oscar Wilde

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rjsmin-1.2.3.tar.gz (417.8 kB view hashes)

Uploaded Source

Built Distributions

rjsmin-1.2.3-cp313-cp313t-musllinux_1_1_x86_64.whl (37.4 kB view hashes)

Uploaded CPython 3.13t musllinux: musl 1.1+ x86-64

rjsmin-1.2.3-cp313-cp313t-musllinux_1_1_i686.whl (37.6 kB view hashes)

Uploaded CPython 3.13t musllinux: musl 1.1+ i686

rjsmin-1.2.3-cp313-cp313t-musllinux_1_1_aarch64.whl (37.2 kB view hashes)

Uploaded CPython 3.13t musllinux: musl 1.1+ ARM64

rjsmin-1.2.3-cp313-cp313t-manylinux2014_aarch64.whl (33.9 kB view hashes)

Uploaded CPython 3.13t

rjsmin-1.2.3-cp313-cp313t-manylinux1_x86_64.whl (33.3 kB view hashes)

Uploaded CPython 3.13t

rjsmin-1.2.3-cp313-cp313t-manylinux1_i686.whl (33.4 kB view hashes)

Uploaded CPython 3.13t

rjsmin-1.2.3-cp313-cp313-musllinux_1_1_x86_64.whl (35.6 kB view hashes)

Uploaded CPython 3.13 musllinux: musl 1.1+ x86-64

rjsmin-1.2.3-cp313-cp313-musllinux_1_1_i686.whl (35.8 kB view hashes)

Uploaded CPython 3.13 musllinux: musl 1.1+ i686

rjsmin-1.2.3-cp313-cp313-musllinux_1_1_aarch64.whl (35.5 kB view hashes)

Uploaded CPython 3.13 musllinux: musl 1.1+ ARM64

rjsmin-1.2.3-cp313-cp313-manylinux2014_aarch64.whl (31.9 kB view hashes)

Uploaded CPython 3.13

rjsmin-1.2.3-cp313-cp313-manylinux1_x86_64.whl (31.6 kB view hashes)

Uploaded CPython 3.13

rjsmin-1.2.3-cp313-cp313-manylinux1_i686.whl (31.7 kB view hashes)

Uploaded CPython 3.13

rjsmin-1.2.3-cp312-cp312-musllinux_1_1_x86_64.whl (35.9 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

rjsmin-1.2.3-cp312-cp312-musllinux_1_1_i686.whl (36.0 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ i686

rjsmin-1.2.3-cp312-cp312-musllinux_1_1_aarch64.whl (35.8 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ ARM64

rjsmin-1.2.3-cp312-cp312-manylinux2014_aarch64.whl (31.9 kB view hashes)

Uploaded CPython 3.12

rjsmin-1.2.3-cp312-cp312-manylinux1_x86_64.whl (31.6 kB view hashes)

Uploaded CPython 3.12

rjsmin-1.2.3-cp312-cp312-manylinux1_i686.whl (31.6 kB view hashes)

Uploaded CPython 3.12

rjsmin-1.2.3-cp311-cp311-musllinux_1_1_x86_64.whl (36.0 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

rjsmin-1.2.3-cp311-cp311-musllinux_1_1_i686.whl (36.0 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ i686

rjsmin-1.2.3-cp311-cp311-musllinux_1_1_aarch64.whl (35.9 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ ARM64

rjsmin-1.2.3-cp311-cp311-manylinux2014_aarch64.whl (32.2 kB view hashes)

Uploaded CPython 3.11

rjsmin-1.2.3-cp311-cp311-manylinux1_x86_64.whl (31.6 kB view hashes)

Uploaded CPython 3.11

rjsmin-1.2.3-cp311-cp311-manylinux1_i686.whl (31.8 kB view hashes)

Uploaded CPython 3.11

rjsmin-1.2.3-cp310-cp310-musllinux_1_1_x86_64.whl (34.2 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

rjsmin-1.2.3-cp310-cp310-musllinux_1_1_i686.whl (34.3 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ i686

rjsmin-1.2.3-cp310-cp310-musllinux_1_1_aarch64.whl (34.2 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ ARM64

rjsmin-1.2.3-cp310-cp310-manylinux2014_aarch64.whl (30.6 kB view hashes)

Uploaded CPython 3.10

rjsmin-1.2.3-cp310-cp310-manylinux1_x86_64.whl (34.9 kB view hashes)

Uploaded CPython 3.10

rjsmin-1.2.3-cp310-cp310-manylinux1_i686.whl (34.9 kB view hashes)

Uploaded CPython 3.10

rjsmin-1.2.3-cp39-cp39-musllinux_1_1_x86_64.whl (34.0 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

rjsmin-1.2.3-cp39-cp39-musllinux_1_1_i686.whl (34.1 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ i686

rjsmin-1.2.3-cp39-cp39-musllinux_1_1_aarch64.whl (33.9 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ ARM64

rjsmin-1.2.3-cp39-cp39-manylinux2014_aarch64.whl (30.1 kB view hashes)

Uploaded CPython 3.9

rjsmin-1.2.3-cp39-cp39-manylinux1_x86_64.whl (28.9 kB view hashes)

Uploaded CPython 3.9

rjsmin-1.2.3-cp39-cp39-manylinux1_i686.whl (28.7 kB view hashes)

Uploaded CPython 3.9

rjsmin-1.2.3-cp38-cp38-musllinux_1_1_x86_64.whl (34.2 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

rjsmin-1.2.3-cp38-cp38-musllinux_1_1_i686.whl (34.3 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ i686

rjsmin-1.2.3-cp38-cp38-musllinux_1_1_aarch64.whl (34.1 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ ARM64

rjsmin-1.2.3-cp38-cp38-manylinux2014_aarch64.whl (30.7 kB view hashes)

Uploaded CPython 3.8

rjsmin-1.2.3-cp38-cp38-manylinux1_x86_64.whl (29.1 kB view hashes)

Uploaded CPython 3.8

rjsmin-1.2.3-cp38-cp38-manylinux1_i686.whl (29.0 kB view hashes)

Uploaded CPython 3.8

rjsmin-1.2.3-cp37-cp37m-musllinux_1_1_x86_64.whl (34.7 kB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ x86-64

rjsmin-1.2.3-cp37-cp37m-musllinux_1_1_i686.whl (34.8 kB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ i686

rjsmin-1.2.3-cp37-cp37m-musllinux_1_1_aarch64.whl (34.5 kB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ ARM64

rjsmin-1.2.3-cp37-cp37m-manylinux2014_aarch64.whl (31.2 kB view hashes)

Uploaded CPython 3.7m

rjsmin-1.2.3-cp37-cp37m-manylinux1_x86_64.whl (29.8 kB view hashes)

Uploaded CPython 3.7m

rjsmin-1.2.3-cp37-cp37m-manylinux1_i686.whl (29.7 kB view hashes)

Uploaded CPython 3.7m

rjsmin-1.2.3-cp36-cp36m-musllinux_1_1_x86_64.whl (33.8 kB view hashes)

Uploaded CPython 3.6m musllinux: musl 1.1+ x86-64

rjsmin-1.2.3-cp36-cp36m-musllinux_1_1_i686.whl (33.8 kB view hashes)

Uploaded CPython 3.6m musllinux: musl 1.1+ i686

rjsmin-1.2.3-cp36-cp36m-musllinux_1_1_aarch64.whl (33.6 kB view hashes)

Uploaded CPython 3.6m musllinux: musl 1.1+ ARM64

rjsmin-1.2.3-cp36-cp36m-manylinux2014_aarch64.whl (30.2 kB view hashes)

Uploaded CPython 3.6m

rjsmin-1.2.3-cp36-cp36m-manylinux1_x86_64.whl (28.8 kB view hashes)

Uploaded CPython 3.6m

rjsmin-1.2.3-cp36-cp36m-manylinux1_i686.whl (28.6 kB view hashes)

Uploaded CPython 3.6m

rjsmin-1.2.3-cp27-cp27mu-manylinux1_x86_64.whl (27.8 kB view hashes)

Uploaded CPython 2.7mu

rjsmin-1.2.3-cp27-cp27mu-manylinux1_i686.whl (27.6 kB view hashes)

Uploaded CPython 2.7mu

rjsmin-1.2.3-cp27-cp27m-manylinux1_x86_64.whl (27.8 kB view hashes)

Uploaded CPython 2.7m

rjsmin-1.2.3-cp27-cp27m-manylinux1_i686.whl (27.6 kB view hashes)

Uploaded CPython 2.7m

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page