css-obfuscator
is a powerful CLI tool that helps obfuscate CSS classes in your project, supporting code cleaning and protection of sensitive information. This tool is designed to work with projects using Next.js, Tailwind CSS, or any other CSS framework.
- CSS Class Obfuscation: Renames CSS classes to protect source code and reduce the possibility of code reversal.
- Easy-to-use CLI: Provides a simple command-line interface for easy integration into the development process.
- TypeScript Support: Built-in TypeScript support to improve development experience.
To install css-obfuscator
, you can use npm or yarn.
npm install -g css-obfuscator
npm install --save-dev css-obfuscator
Below are the basic commands to use css-obfuscator
.
css-obfuscator [options]
-
--input, -i
: Path to the CSS file or directory to obfuscate. -
--output, -o
: Path to the output directory to store obfuscated CSS files. -
--help, -h
: Display help about options and command syntax.
Obfuscate CSS classes from the src/css
directory and save the result to dist/css
:
css-obfuscator -i src/css -o dist/css
css-obfuscator
supports configuration through JSON or JavaScript configuration files. You can customize how the tool obfuscates CSS classes according to your needs.
{
"input": "src/css",
"output": "dist/css",
"prefix": "obf_"
}
css-obfuscator
can be integrated into your CI/CD pipeline. You can configure the tool to run automatically when building or testing the project.
stages:
- build
build_css_obfuscation:
stage: build
script:
- npx css-obfuscator -i src/css -o dist/css
Run linter tests to ensure the source code follows coding rules:
npm run lint
Use Prettier to format the source code:
npm run format
Build the project and create output files:
npm run build
To publish a new version of the tool to npm, run:
npm run publish@npm
We always welcome contributions from the community. If you want to participate in improving this project, please follow these steps:
- Fork the project.
- Create a new branch for your changes (
git checkout -b my-feature
). - Make changes and commit (
git commit -am 'Add some feature'
). - Push your branch to GitHub (
git push origin my-feature
). - Open a Pull Request.
This project is released under the ISC License.
If you have any questions or feedback, please contact us via GitHub Issues.