js-min
A community fork of the jsmin JavaScript minifier.
- GitHub: https://github.com/QQSHI13/js-min
- PyPI package:
min-js - Python module:
js_min
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-minmakes 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
- Install from PyPI: https://pypi.org/project/min-js/
- Latest release branch on GitHub: https://github.com/QQSHI13/js-min/tree/latest-release/js_min
- Development version on GitHub: https://github.com/QQSHI13/js-min/
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):
- Dave St.Germain — original author
- Hans weltar
- Tikitu de Jager — upstream maintainer
- https://bitbucket.org/rennat
- Nick Alexander
- Gennady Kovshenin
- Matt Molyneaux
- Albert Wang
- Ben Bradshaw
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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file min_js-3.1.0.tar.gz.
File metadata
- Download URL: min_js-3.1.0.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
367ddf534484f9287a2863f8ec595e949e706952257529679bcb34670053018d
|
|
| MD5 |
c5dc589aa723a11c8099433e2d1c8500
|
|
| BLAKE2b-256 |
6b6055345c565e3926cd5b94fa1a4ac0adf4ed5f02341d5c1543d4dc31e3d65f
|
Provenance
The following attestation bundles were made for min_js-3.1.0.tar.gz:
Publisher:
publish.yml on QQSHI13/js-min
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
min_js-3.1.0.tar.gz -
Subject digest:
367ddf534484f9287a2863f8ec595e949e706952257529679bcb34670053018d - Sigstore transparency entry: 2472369495
- Sigstore integration time:
-
Permalink:
QQSHI13/js-min@4b86c2cf771e09e2c2ec2a18766661146ee033b9 -
Branch / Tag:
refs/tags/v3.1.0 - Owner: https://github.com/QQSHI13
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4b86c2cf771e09e2c2ec2a18766661146ee033b9 -
Trigger Event:
release
-
Statement type:
File details
Details for the file min_js-3.1.0-py3-none-any.whl.
File metadata
- Download URL: min_js-3.1.0-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60a398b5952f7187811ee7722ff414145df409d3682ae3dbf184a814188c44ac
|
|
| MD5 |
443bf2624d4e58e9545158716115414d
|
|
| BLAKE2b-256 |
26e0458f4b8e09182eb9bba2affc37be4541f3cc11b01832cd27a479c6627a4e
|
Provenance
The following attestation bundles were made for min_js-3.1.0-py3-none-any.whl:
Publisher:
publish.yml on QQSHI13/js-min
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
min_js-3.1.0-py3-none-any.whl -
Subject digest:
60a398b5952f7187811ee7722ff414145df409d3682ae3dbf184a814188c44ac - Sigstore transparency entry: 2472369507
- Sigstore integration time:
-
Permalink:
QQSHI13/js-min@4b86c2cf771e09e2c2ec2a18766661146ee033b9 -
Branch / Tag:
refs/tags/v3.1.0 - Owner: https://github.com/QQSHI13
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4b86c2cf771e09e2c2ec2a18766661146ee033b9 -
Trigger Event:
release
-
Statement type: