Contributing to PurifyCSS

We welcome contributions from the community! Whether it's a bug report, a new feature, or an improvement to the documentation, your help is appreciated.

Development Setup

To get started with development, you'll need to set up the project locally.

  1. Fork and Clone: Fork the repository on GitHub, then clone your fork locally.

    git clone https://github.com/YOUR_USERNAME/purifycss.git
    cd purifycss

  2. Install Dependencies: The project uses npm to manage its dependencies. Install them by running:

    npm install

Project Scripts

The package.json file contains several scripts to help with development:

  • npm run build: Builds the project from the src/ directory into the lib/ directory using Rollup. This creates both CommonJS and ES Module versions of the library.

  • npm run dev: Starts a watch process that automatically rebuilds the library whenever you make changes to the source files in src/.

  • npm run test: Runs the entire test suite using Jest. All tests are located in the __tests__ directory.

Code Style

This project uses ESLint to enforce a consistent code style. The rules are defined in the .eslintrc file. Before submitting a pull request, please ensure your code conforms to these standards. You can check your code by running your editor's ESLint integration or by setting up a pre-commit hook.

Submitting a Pull Request

  1. Create a new branch for your feature or bugfix.
  2. Make your changes and add tests for them if applicable.
  3. Ensure all tests pass by running npm run test.
  4. Commit your changes with a clear and descriptive message.
  5. Push your branch to your fork.
  6. Open a pull request from your fork to the purifycss/purifycss master branch.

Please provide a clear description of the changes in your pull request.