- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Which one is the Python module to obfuscate javascript?
You can use the jsmin module to minimize/obfuscate javascript code using Python. Install jsmin using:
$ pip install jsmin
To use jsmin in your python project to minimize a js file, say hello.js, you can use it as follows:
>>> from jsmin import jsmin >>> with open('hello.js') as js_file: ... minified = jsmin(js_file.read()) >>> print minified
You'll get the minified JS code printed to your shell. You can also use jsmin as a command line tool:
$ python -m jsmin hello.js
You can read more about jsmin on pypi docs: https://pypi.python.org/pypi/jsmin
Advertisements