Có thể dùng module jsmin để minimize/obfuscate mã JavaScript bằng Python. Cài đặt jsmin:
$ pip install jsmin
Để dùng jsmin trong dự án Python minimize file js, ví dụ hello.js:
>>> from jsmin import jsmin >>> with open('hello.js') as js_file: ... minified = jsmin(js_file.read()) >>> print minifiedBạn sẽ nhận mã JS minified in ra shell. Cũng dùng jsmin như công cụ dòng lệnh:
$ python -m jsmin hello.js
Đọc thêm về jsmin trên pypi: https://pypi.python.org/pypi/jsmin