Thanks for your interest in contributing to CSS Parser. This guide explains how to get the project running locally, update its generated configuration data, run the checks, and submit a change. It is intended to help new contributors get started and make contributions easier to review.
-
Fork the repository on GitHub.
-
Clone your fork and enter the project directory:
git clone https://github.com/<your-user-name>/css-parser.git cd css-parser
-
Add the upstream repository and install the root project dependencies:
git remote add upstream https://github.com/tbela99/css-parser.git npm install
-
Create a branch for your change:
git switch -c descriptive-branch-name
Use a current Node.js release compatible with the project dependencies.
The repository includes scripts for refreshing generated CSS property and syntax data. Run them from the project root:
npm run config-update
npm run syntax-updateconfig-update regenerates src/data/properties.json. syntax-update regenerates src/data/validation.json from upstream CSS data and therefore requires an internet connection. Review the generated changes and include them when they are relevant to your contribution.
Run the build command:
npm run buildValidate your changes before committing using deno:
deno publish --dry-runRun the complete Node.js and browser test suites before submitting a change:
npm testFor a quicker, focused check, run either suite:
npm run test:node
npm run test:webThe browser tests use Playwright with Chromium, Firefox, and WebKit. Install the required browsers if Playwright reports that they are missing.
For debugging, run either suite:
npm run debug:node
npm run debug:webGenerate Node.js coverage reports with:
npm run test:covThe command prints a text summary and writes an HTML report under coverage/. Browser coverage can be collected separately with:
npm run test:web-covWhen changing behavior, add or update tests that exercise it and use the coverage reports to spot untested paths.
The benchmark has its own dependencies and must be run from the benchmark/ directory:
cd benchmark
npm install
npm run allThis computes output sizes, runs the timing benchmarks, and generates benchmark/results/benchmark.html. Open that report to inspect the results. To run individual stages, use npm run sizes, npm run bench, or npm run report from benchmark/.
-
Review your changes and make sure no unrelated generated files or benchmark results are included.
-
Run the relevant tests; include coverage or benchmark results when they help explain the change.
-
Push your branch to your fork:
git push -u origin descriptive-branch-name
-
Open a pull request on GitHub against
tbela99/css-parser'smasterbranch. -
In the pull request description, explain the problem and the proposed change, link any related issue, and list the checks you ran. Include before-and-after benchmark results for performance-related changes.
Keep each pull request focused, and be ready to discuss or revise the change during review.