Skip to main content

js-min

PyPI version Publish CodeQL License: MIT

A community fork of the jsmin JavaScript minifier.

Install

pip install min-js

Usage

from js_min import jsmin

with open('myfile.js') as js_file:
    minified = jsmin(js_file.read())

Command line:

python -m js_min myfile.js

Note: js-min makes no attempt to be compatible with ECMAScript 6 / ES.next / Harmony.

If you are minifying ES6 code, you can use the quote_chars parameter:

from js_min import jsmin

with open('myfile.js') as js_file:
    minified = jsmin(js_file.read(), quote_chars="'\"`")

Where to get it

Python 2 support removed

Python 2 support was removed in version 3.0.0. If you need to support Python 2, please use jsmin version 2.2.2 with setuptools<58.

Contributing

Issues and Pull requests are welcome.

The upstream project used to be hosted on Bitbucket and old issues can still be found there.

If possible, please make separate pull requests for tests and for code: tests will be added to the latest-release branch while code will go to main.

Unless you request otherwise, your GitHub identity will be added to the contributor list below.

Contributors

Historical contributors (chronological commit order):

Users

If your project uses js-min, feel free to open a PR adding it to this list.

  • Your project here

Changelog

v3.0.0 (2021-09-08) Ben Bradshaw

  • Breaking Change: Removed support for Python 2

  • Removed usage of use_2to3 in setup.py

v2.2.2 (2017-05-01) Tikitu de Jager

  • Add license headers to code files (fixes i#17)

  • Remove mercurial files (fixes #20)

v2.2.1 (2016-03-06) Tikitu de Jager

  • Fix #14: Infinite loop on return x / 1;

v2.2.0 (2015-12-19) Tikitu de Jager

  • Merge #13: Preserve "loud comments" starting with /*!

    These are commonly used for copyright notices, and are preserved by various other minifiers (e.g. YUI Compressor).

v2.1.6 (2015-10-14) Tikitu de Jager

  • Fix #12: Newline following a regex literal should not be elided.

v2.1.5 (2015-10-11) Tikitu de Jager

  • Fix #9: Premature end of statement caused by multi-line comment not adding newline.

  • Fix #10: Removing multiline comment separating tokens must leave a space.

  • Refactor comment handling for maintainability.

v2.1.4 (2015-08-23) Tikitu de Jager

  • Fix #6: regex literal matching comment was not correctly matched.

  • Refactor regex literal handling for robustness.

v2.1.3 (2015-08-09) Tikitu de Jager

  • Reset issue numbering: issues live in github from now on.

  • Fix #1: regex literal was not recognised when occurring directly after {.

v2.1.2 (2015-07-12) Tikitu de Jager

  • Issue numbers here and below refer to the bitbucket repository.

  • Fix #17: bug when JS starts with comment then literal regex.

v2.1.1 (2015-02-14) Tikitu de Jager

  • Fix #16: bug returning a literal regex containing escaped forward-slashes.

v2.1.0 (2014-12-24) Tikitu de Jager

  • First changelog entries; see README.rst for prior contributors.

  • Expose quote_chars parameter to provide just enough unofficial Harmony support to be useful.

Metadata

Release files for min-js 3.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for min-js 3.1.1
File Size Uploaded
min_js-3.1.1.tar.gz 13.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for min-js 3.1.1
File Interpreter ABI Platform
min_js-3.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 27.4 kB

Release files / min_js-3.1.1.tar.gz

Download URL min_js-3.1.1.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ecd42c531a1628a65df86127f90199ed8c71801adaa99e70578096b3ebd931a5
BLAKE2b-256 checksum
How to use checksums
8447e027c7ffd5b02c8fcc77a4998709d66725b6c2f66774d43425de2a5d9d60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 15, 2026.

Transparency log

Release files / min_js-3.1.1-py3-none-any.whl

Download URL min_js-3.1.1-py3-none-any.whl
Size 13.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f3bf061c72398b1d9d6af9a6970a2b427fe38ccd1bf53ba5e0b770b213a43c0
BLAKE2b-256 checksum
How to use checksums
22d08d3b19f678d1493f6f02d2ddb8faa78585d6c01b876edbc7072419e146eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

3.1.1 This release

2 release files

3.1.0

2 release files

3.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page