npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

Iโ€™ve always been into building performant and accessible sites, but lately Iโ€™ve been taking it extremely seriously. So much so that Iโ€™ve been building a tool to help me optimize and monitor the sites that I build to make sure that Iโ€™m making an attempt to offer the best experience to those who visit them. If youโ€™re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, ๐Ÿ‘‹, Iโ€™m Ryan Hefnerย  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If youโ€™re interested in other things Iโ€™m working on, follow me on Twitter or check out the open source projects Iโ€™ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soonโ€“ish.

Open Software & Tools

This site wouldnโ€™t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you ๐Ÿ™

ยฉ 2024 โ€“ย Pkg Stats / Ryan Hefner

styled2tailwind

v1.0.0

Published

<div align="center"> <h1>Styled2Tailwind ๐ŸŒ€</h1> <p>Transform your Styled-Components into TailwindCSS with this handy codemod.</p> <br />

Downloads

161

Readme

๐ŸŒŸ Motivation

With Next.js introducing the new App Directory routing, it also introduced support for Server and Client components. Styled-components don't gel well with server components due to their heavy reliance on the JS runtime. Tailwind, on the other hand, slides right in and performs beautifully!

We also love Tailwind and we believe it enhances the development process, making it faster with a superior developer experience.

๐Ÿš€ Getting Started

  1. Begin by giving the repository a star! โญ
  2. Type the following command to dive into the CLI world:
$ npx styled2tailwind --help

๐Ÿค” How It Works

Our mechanism runs in four distinct steps:

  1. Raw Input: We start by taking the RAW React Component as input (make sure it includes some styled components).
  2. JavaScript AST: Convert the component to JavaScript AST using Babel.
  3. From AST to CSS: Extract all TemplateLiterals data from the AST and morph it into CSS.
  4. Tailwind Conversion: The final leg involves converting this CSS into TailwindCSS format.
flowchart LR
  RSI(Raw Styled Input) --> JSAST(JavaScript AST)
  JSAST --> RCSS(Raw CSS)
  RCSS --> TW(Tailwind CSS)

๐Ÿ“‹ Commands Overview

| Command | Description | |---------|-------------| | styled2tailwind --help | Displays help command. | | styled2tailwind "src/*.jsx" | Parses all .jsx files inside src directory (supports regex). | | styled2tailwind "src/*.jsx" --no-replace | Instead of replacing styled components with tailwind, it appends the tailwind output at the end of the file. | | styled2tailwind "src/*.jsx" --no-conflicts | Forcefully replaces styled components with tailwind in the markup without using git conflicts. |

โš ๏ธ Limitations

This project is still in early beta, we already tracked some limitations and we will ship fix for those in very near future!

  • Multi-Line Components: CLI can act mysteriously while one component is wrapped into multiple lines.
  • Dynamic React Props: Handling dynamic React props (especially functions) still poses a challenge.

๐Ÿค Contribution

Contributions are always welcome! To contribute, please follow these steps:

  1. Fork the repository.
  2. Create a new branch with a descriptive name.
  3. Make your changes, and commit them using the Conventional Commits format.
  4. Push your changes to the forked repository.
  5. Create a pull request, and we'll review your changes.

๐Ÿซถ Support

If you're looking for help or simply want to share your thoughts about the project, we encourage you to join our Discord community. Here's the link: https://blazity.com/discord. It's a space where we exchange ideas and help one another. Everyone's input is appreciated, and we look forward to welcoming you.

๐Ÿ“œ License

This project is licensed under the MIT License. For more information, see the LICENSE file.