As the creators and maintainers of this project, we want to ensure that styled-components
lives and continues to grow and evolve. The evolution of the library should never be blocked by any single person's time. One of the simplest ways of doing this is by encouraging a larger set of shallow contributors. Through this, we hope to mitigate the problems of a project that needs updates but there's no one who has the power to do so.
To quote @alloy from this issue:
Don't ever feel bad for not contributing to open source.
We want contributors to provide ideas, keep the ship shipping and to take some of the load from others. It is non-obligatory; we’re here to get things done in an enjoyable way. 🏆
It's important to note that all repositories under the styled-components
banner have a Code of Conduct. Please review and help enforce this CoC should any violations happen if you feel comfortable doing so.
These days, we highly recommend trying a tool like ChatGPT to get instant feedback and tips. @quantizor can be reached on X to start a private conversation, but please keep in mind that response is not guaranteed since open source is volunteer effort and subject to personal availability.
- Ensure
yarn
is installed (https://yarnpkg.com/getting-started/install) - Fork the repository, then pull it down to your disk:
git clone [email protected]:YOUR_USERNAME/styled-components.git
- Hop into the styled-components folder and run
yarn install
- Set the base repository as upstream:
git remote add upstream [email protected]:styled-components/styled-components.git
(makes it easier to pull updates to your fork)
At this point, the repository is initialized and ready for development! Check the packages/
folder for the styled-components
core library, a development sandbox
(great for testing functionality), and the benchmarks
suite.
Helpful commands:
- run unit tests:
yarn run test
- check code style
yarn run prettier
(handled automatically if you have a prettier extension installed in your IDE) - run build:
yarn run build
- run dev sandbox:
yarn workspace sandbox dev
(or justyarn dev
if you're in that folder)
Here is a quick guide to doing code contributions to the library.
-
Find some issue you're interested in, or a feature that you'd like to tackle. Also make sure that no one else is already working on it. We don't want you to be disappointed.
-
Update your local copy of the
main
branch with the latest code:git checkout main && git pull -f upstream/main
-
Create a branch with a meaningful name for the issue:
git checkout -b fix-something
-
Run
yarn install
to capture any dependency updates -
Make desired changes...
-
Push your branch:
git push -u origin your-branch-name
-
Submit a pull request to the upstream styled-components repository.
-
Choose a descriptive title and describe your changes briefly.
-
Wait for a maintainer to review your PR, make changes if it's being recommended, and get it merged.
-
Perform a celebratory dance! 💃
We have three different benchmarks: mounting a deep tree, mounting a wide tree and updating dynamic styles. Shoutout to @necolas, who wrote these for react-native-web
and whom we stole these benchmarks from.
To run the benchmarks run:
cd packages/benchmarks
Then build the benchmark page:
yarn run build
Then open the page in your browser:
yarn run open
On the page which opens, select the benchmark to run and click the "Run" button in your browser.
You may need to re-build styled-components and/or the benchmarks package after making changes if you want to re-run the benchmarks with your changes.
These contribution guidelines are based on https://github.com/moya/contributors, big thanks to @alloy, @orta et al. for the inspiration and guidance.
Please see the "Sponsor" button at the top of the repository, thank you!
Thank you to all the people who have already contributed to styled-components!
Thank you to all our backers! [Become a backer]
Thank you to all our sponsors! (please ask your company to also support this open source project by becoming a sponsor)