Contributing
Thank you for considering contributing to Semanticus CSS!
Semanticus CSS is the sum of all the work done by Pico CSS and Bootstrap's original author(s) and the contributions, plus the work of the author and maintainer of this project.
Hopefully this will change and your name gets added to the list of contributors as well.
The roadmap, bug fixes and keeping up to date with new emerging patterns is a daunting task for one person alone and I'd love for you to be part of shaping the future of this project.
When contributing, please keep the Core Principles in mind.
Code Guidelines
Adding New Features
- Semantic component → add
src/semantics/_<element>.cssand import it insrc/semantics/modules.css - Utility class → add to the appropriate
src/utilities/<category>/_<file>.css - Variant class → add to
src/variants/_<file>.cssand import insrc/variants/modules.css - Palette → add
src/palettes/<name>.cssand register it inscripts/build-palettes.js - Size → add
src/sizes/<name>.cssand register it inscripts/build-sizes.js
Code Style
Follow the existing CSS conventions — see Token Conventions for the naming rules applied to CSS custom properties
Use CSS custom properties (
--*) for theming rather than hard-coded valuesBefore submitting:
- Run the linter:
bashnpm run lint- and the visual regression tests if your change affects styles:
bashnpm test
Documentation
If your contribution is user-facing, please update the documentation:
- Update relevant guides in
docs/ - Include examples showing semantic HTML usage
- Explain any accessibility considerations
- Document CSS variables that can be customized
How to setup the project
Install Node.js (v18 or higher recommended) if you haven't already.
Clone the repository
git clone https://github.com/semanticus/semanticus-css.git- Move into the project directory
cd semanticus-css- Install dependencies
npm installDevelopment
Make sure to build the project before running the development servers:
npm run build- Scenario 1: Changes to the
*.cssfiles in thesrcdirectory
Launch storybook at http://localhost:6006 by running:
npm run storybook- Scenario 2: Changes to the
*.mdfiles in thedocs/directory
Launch vitepress at http://localhost:5173 by running:
npm run docs:devIn both scenarios, you will probably want add or update the existing *.demo.ts files in the demos/ directory that contain the HTML examples used both by storybook and vitepress.
Testing
Semanticus CSS uses Playwright for visual regression testing.
To run the test suite, use:
npm testTo run a specific test:
npm test <path to the spec.ts file>When writing new tests, or when you want to debug existing ones:
npm run test:devSnapshot consistency and the dev container
Playwright's pixel-level snapshots are sensitive to the OS and browser rendering engine. To ensure that snapshots are always generated in the same environment as CI, this project ships a dev container (.devcontainer/devcontainer.json) based on the official Playwright Docker image (mcr.microsoft.com/playwright:v1.59.1-noble, Ubuntu 24.04).
You must generate and update snapshots inside the dev container. Snapshots committed from a different OS (macOS, Windows, a different Linux distro) will differ from the ones used in CI and will cause test failures on every run.
Opening the dev container
- Install the Dev Containers extension in VS Code.
- Open the command palette (
Ctrl+Shift+P/Cmd+Shift+P) and run Dev Containers: Reopen in Container. - VS Code will build the container and run
npm ciautomatically.
Before opening a PR
If your changes affect any styles, run the full test suite inside the dev container and commit any snapshot changes:
# Run the tests — this will flag any visual regressions
npm test
# If the visual changes are intentional, update the snapshots
npm run test:update-snapshotsCommit the updated tests/_snapshots/ files alongside your other changes. PRs that introduce style changes without updated snapshots will fail CI.