CSS Cleanup API is a simple Node.js API for cleaning up unused CSS. It utilizes the purify-css and purgecss libraries. Users can choose the cleanup engine by providing the "engine" parameter when calling the API, which can be set to either "purify" or "purge."
- Clean Up Unused CSS: Remove unused CSS from provided HTML code or URLs.
- Choose Cleanup Engine: Select between the "purify" or "purge" engine to suit your needs.
- Node.js (version 12 or higher)
- pnpm for development
-
Clone the repository:
git clone https://github.com/fadlee/css-cleanup-api.git
Install dependencies using pnpm:
pnpm install
Run the API locally:
pnpm start
Test the API with cURL:
curl -X POST -H "Content-Type: application/json" -d '{"urls": ["https://example.com/"], "htmlCode": "<div></div>", "engine": "purify"}' http://localhost:3000/cleanup-css
- urls (Array of Strings): An array of URL strings to fetch and clean up CSS.
- htmlCode (String): HTML code for which CSS cleanup is required.
- engine (String): Specify the cleanup engine. Accepted values are "purify" or "purge."
Feel free to contribute to the project! Check out the Contribution Guidelines for more information.
This project is licensed under the MIT License - see the LICENSE file for details.