You want to help? You rock! Now, take a moment to be sure your contributions make sense to everyone else.
Found a problem? Want a new feature?
- See if your issue or idea has already been reported.
- Provide a reduced test case or a live example.
Remember, a bug is a demonstrable problem caused by our code.
If this guide itself is not working or is not clear, please report it.
If you do need to set the project up locally yourself, feel free to follow these instructions:
- Node.js >= 16.0.0
- fork the repo and clone it locally
npm run ci
to install dependenciescd plugins/<plugin-name>
npm run build && npm run test
to build and test the plugin after making changes- open a pull request with the changes
Always check package.json
in the directory you are working in.
This file has a scripts
field with all the available commands.
These are some of the common commands you will find there :
npm run build
For things like TypeScript, bundling,... Most plugins and packages need to be build after a code change.npm run test
To run the test suite.npm run test:rewrite-expects
Most of our tests have files with the expected output and others with the actual output. To update the expected output you can run this command.npm run lint
To manually run the linters.npm run docs
Most of our plugins have generated docs. Update the source file under./docs
and then run this command.
We try our best to create a safe and welcoming environment for contributors.
Your changes do not have to be complete and tests do not have to pass before opening a pull request. Receiving early feedback on your work will help you iterate more quickly in the right direction.
-
To begin; fork this project, clone your fork, and add our upstream.
# Clone your fork of the repo into the current directory git clone https://github.com/<YOUR_USER>/postcss-plugins.git # Navigate to the newly cloned directory cd postcss-plugins
-
Create a branch for your feature or fix:
# Move into a new branch for your feature git checkout -b your-thing
-
Navigate to the plugin you want to contribute to.
# Navigate to a plugin directory cd plugins/<plugin-name>
# Navigate to the postcss-preset-env directory cd plugin-packs/postcss-preset-env
-
If your code follows our practices, then push your feature branch:
# Run the linter npm run lint # Test current code npm run build && npm run test
# Push the branch for your new feature git push origin your-thing
That’s it! Now open a pull request with a clear title and description.
Each public package has a CHANGELOG.md
file.
We use a structured format to indicate which packages have unreleased changes.
If you open a pull request you may add a new change log entry describing your change.
The structured format is :
# `<package name>`
### Unreleased (`<semver version bump>`)
- `<your change>`
- `<another change>`
for example :
# Changes to PostCSS Attribute Case Insensitive
### Unreleased (patch)
- Reduce the amount of duplicate fallback CSS.
Adding change log entries is not required for opening pull requests and maintainers can add these for you.
The change description itself is freeform, we do not have a fixed format.
- Follow the guide for submitting a pull request
- Run
npm run ci
if you want to start local development. - Run
npm run new-plugin <Your Plugin Name>
to create a new plugin.
npm run new-plugin
A plugin name must be provided:
new-plugin <human readable name>
new-plugin Cascade Layers
npm run new-plugin Cascade Layers
- Creating new plugin Cascade Layers
- Copied base plugin to ./plugins/postcss-cascade-layers
- Cleaned up files and directories not required in a new plugin
- Relabeled references to base plugin
- Updated "package.json"
Done! 🎉
Your next steps:
- Run : "npm install" from the root directory
- Run : "cd plugins/postcss-cascade-layers"
- Run : "npm run build" to build your plugin
- Run : "npm run test" to test your plugin
- Run : "npm run test:rewrite-expects" to update test result files
Change "blue" to "purple" in "src/index.ts" and see how it affects the test outcome
- PostCSS API documentation
- PostCSS guidelines for plugins
- CSSTools technical guidelines for plugins
- CSSTools authoring guidelines
If you encounter any issues not mentioned here, please open an issue so that we can extend the guides.