Introducing emojis-cleaner β Remove Emojis from Any File or Codebase (CLI + JS API)
Have you ever opened a file in your codebase and found random emojis inside comments, logs, commits, or strings?
Yes, they look aestheticβ¦ until they break your CI, minifiers, builds, or linters. π
I ran into this too many times and decided to fix it once and for all.
So today, I'm excited to introduce:
emojis-cleaner β a simple tool to remove all emojis from any project
NPM: https://www.npmjs.com/package/emojis-cleaner
emojis-cleaner is a tiny Node.js package + CLI tool that:
β Removes all emojis from any text
β Works on any file type (JS, TS, HTML, JSON, Markdown, etc.)
β Can clean entire folders recursively
β Automatically ignores node_modules
β Can also be used directly in JS code
Whether you want to sanitize logs, clean content, or enforce βno emojis in codeβ, this tool does the job.
Installation
Global (use as CLI)
npm install -g emojis-cleaner
Local
npm install emojis-cleaner
Usage (CLI)
Clean all emojis from a folder
emojis-cleaner .
Clean emojis from a specific file
emojis-cleaner src/index.js
Example Output
Cleaned: src/app.js
Cleaned: src/utils/logs.js
Cleaned: README.md
Emoji removal complete!
The CLI scans everything recursively, removes emojis, and updates files in place.
π§ Use as a Function (Node.js API)
You can also use the same logic inside your Node scripts:
const removeEmojis = require("emojis-cleaner");
console.log(removeEmojis("Hello π World π"));
// Output: "Hello World "
This uses a reliable Unicode regex to detect all emojis, including:
Why I Built This
I was working on a project where random emojis were added in:
They looked harmless, but:
I searched for a tool that simply scans everything and removes emojis, but couldnβt find one that:
Soβ¦ I built it π
π οΈ How It Works (Internally)
The CLI:
const emojiRegex = /\p{Extended_Pictographic}/gu;
The API:
function removeEmojis(str) {
return str.replace(emojiRegex, "");
}
Simple, predictable, effective.
Roadmap / Future Features
Planned improvements:
If you want any specific feature, drop a comment!
Final Thoughts
emojis-cleaner is intentionally small and focused β a βjust remove emojisβ utility that works out of the box.
If your project needs clean logs, consistent file formats, or emoji-free CI pipelines, this tool can help keep things tidy.
Try it here: https://www.npmjs.com/package/emojis-cleaner
If youβd like to contribute, suggest new features, or request enhancements, feel free to comment or open a PR.
Thanks for reading!
More...
Have you ever opened a file in your codebase and found random emojis inside comments, logs, commits, or strings?
Yes, they look aestheticβ¦ until they break your CI, minifiers, builds, or linters. π
I ran into this too many times and decided to fix it once and for all.
So today, I'm excited to introduce:
emojis-cleaner β a simple tool to remove all emojis from any project
NPM: https://www.npmjs.com/package/emojis-cleaner
emojis-cleaner is a tiny Node.js package + CLI tool that:
β Removes all emojis from any text
β Works on any file type (JS, TS, HTML, JSON, Markdown, etc.)
β Can clean entire folders recursively
β Automatically ignores node_modules
β Can also be used directly in JS code
Whether you want to sanitize logs, clean content, or enforce βno emojis in codeβ, this tool does the job.
Installation
Global (use as CLI)
npm install -g emojis-cleaner
Local
npm install emojis-cleaner
Usage (CLI)
Clean all emojis from a folder
emojis-cleaner .
Clean emojis from a specific file
emojis-cleaner src/index.js
Example Output
Cleaned: src/app.js
Cleaned: src/utils/logs.js
Cleaned: README.md
Emoji removal complete!
The CLI scans everything recursively, removes emojis, and updates files in place.
π§ Use as a Function (Node.js API)
You can also use the same logic inside your Node scripts:
const removeEmojis = require("emojis-cleaner");
console.log(removeEmojis("Hello π World π"));
// Output: "Hello World "
This uses a reliable Unicode regex to detect all emojis, including:
- basic emojis π
- flags π³οΈβπ
- symbols β¨
- multi-emoji clusters π¨βπ©βπ§βπ¦
- skin tones ππ½
Why I Built This
I was working on a project where random emojis were added in:
- Git commit messages
- Code comments
- Debug logs
- JSON configuration files
- Markdown docs
They looked harmless, but:
- Git diffs broke
- Some emojis caused UTF-8 build issues
- Minifiers crashed
- CI complained about βinvalid character 0xF0β
I searched for a tool that simply scans everything and removes emojis, but couldnβt find one that:
- worked on any file
- didn't force me to set configs
- didnβt require regex tweaking
- didnβt fail on multi-emoji clusters
Soβ¦ I built it π
π οΈ How It Works (Internally)
The CLI:
- Resolves the input path
- Recursively scans all files
- Skips node_modules automatically
- Reads each file as UTF-8
- Uses a Unicode property regex:
const emojiRegex = /\p{Extended_Pictographic}/gu;
- Rewrites the file without emojis
The API:
function removeEmojis(str) {
return str.replace(emojiRegex, "");
}
Simple, predictable, effective.
Roadmap / Future Features
Planned improvements:
- --dry-run mode
- --stats to show how many emojis were removed
- Backup mode (--backup)
- Exclusion patterns (--ignore *.md)
- VS Code extension
- Pre-commit hook examples
If you want any specific feature, drop a comment!
Final Thoughts
emojis-cleaner is intentionally small and focused β a βjust remove emojisβ utility that works out of the box.
If your project needs clean logs, consistent file formats, or emoji-free CI pipelines, this tool can help keep things tidy.
Try it here: https://www.npmjs.com/package/emojis-cleaner
If youβd like to contribute, suggest new features, or request enhancements, feel free to comment or open a PR.
Thanks for reading!
More...