@hungpm372/css-obfuscator
v1.0.16
Published
A CLI tool to obfuscate CSS classes
Downloads
8
Maintainers
Readme
css-obfuscator
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.
Features
- 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.
Installation
To install css-obfuscator
, you can use npm or yarn.
Global Installation
npm install -g css-obfuscator
Local Installation
npm install --save-dev css-obfuscator
Usage
Below are the basic commands to use css-obfuscator
.
Launch the Tool
css-obfuscator [options]
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.
Example
Obfuscate CSS classes from the src/css
directory and save the result to dist/css
:
css-obfuscator -i src/css -o dist/css
Configuration
css-obfuscator
supports configuration through JSON or JavaScript configuration files. You can customize how the tool obfuscates CSS classes according to your needs.
Example Configuration File (.css-obfuscator.config.json
)
{
"input": "src/css",
"output": "dist/css",
"prefix": "obf_"
}
CI/CD Integration
css-obfuscator
can be integrated into your CI/CD pipeline. You can configure the tool to run automatically when building or testing the project.
Example .gitlab-ci.yml
stages:
- build
build_css_obfuscation:
stage: build
script:
- npx css-obfuscator -i src/css -o dist/css
Testing and Building
Run Tests
Run linter tests to ensure the source code follows coding rules:
npm run lint
Format Code
Use Prettier to format the source code:
npm run format
Build Project
Build the project and create output files:
npm run build
Publish to NPM
To publish a new version of the tool to npm, run:
npm run publish@npm
Contributing
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.
License
This project is released under the ISC License.
Contact
If you have any questions or feedback, please contact us via GitHub Issues.