A Python utility to obfuscate JavaScript and minify CSS files inside your FiveM resource folders before distribution.
When you upload a resource to cfx.re using Escrow, only Lua files are encrypted. Your .js and .css files remain fully readable. This tool protects those files by:
- Obfuscating
.jsfiles (control-flow flattening, string array encoding, compaction) - Minifying
.cssfiles (removing whitespace, comments, and redundant code)
The result is a ready-to-distribute .zip file with the same folder structure.
| Requirement | Install |
|---|---|
| Python 3.6+ | python.org |
| Node.js & npm | nodejs.org |
| javascript-obfuscator | npm install -g javascript-obfuscator |
| clean-css-cli | npm install -g clean-css-cli |
Tip
The script will automatically detect missing npm packages and offer to install them for you on first run.
Put fivem-js-css-obfuscator.py in the same directory as the resource folder you want to protect — not inside it.
resources/
├── my_resource/ ← folder you want to obfuscate
│ ├── client.js
│ ├── style.css
│ └── fxmanifest.lua
└── fivem-js-css-obfuscator.py ← script goes HERE
python fivem-js-css-obfuscator.py📁 Resource folder name: my_resource
The script will generate my_resource.zip with all JS obfuscated and CSS minified.
locales.jsfiles are excluded from obfuscation by default to preserve translation functionality.- The original resource folder is never modified — the script works on a temporary copy.
- Only
.jsand.cssfiles are processed; all other files (Lua, HTML, images, etc.) are copied as-is.