Giter VIP home page Giter VIP logo

tailwindui-storybook's Introduction

What is this?

We first used this script to generate Tailwind UI components for one of our projects. The idea is to use Tailwind UI components right from the storybook in our repo, without having to visit Tailwind UI website.

How it works?

The flow consists of 2 steps:

  1. fetching components data from tailwindui.com (using chromium that is automated by playwright)
  2. using that data to generate storybook files (mdx).

The two steps process makes it easy to adjust for future needs.

  • If tailwindui.com changes and we need to adjust the scraper, change tailwindui.js
  • If we need to adjust the structure of the generated mdx files, change tailwindui-storybook.js

Usage

  1. Make sure you have Tailwind UI license and have the login info for tailwindui.com

  2. Clone the repo and run yarn to install the dependencies

  3. Get list of components from tailwindui.com (react/vue/html):

    # Format:
    email=<[email protected]> password=<yourpassword> node tailwindui.js <react|vue|html>
    
    # Example:
    email='[email protected]' password='pass123' node tailwindui.js react

    The command will start chromium and navigate thru tailwindui.com website to copy the components codes. Here's how it looks like:

    tailwindui-storybook

  4. Once done, you'll have new file at output/tailwindui-<react|vue|html>.json.

  5. Now we can create the mdx files based on above json. To do so, run:

    # Replace `react.json` suffix with `vue.json` as you fit
    node tailwindui-storybook.js ./output/tailwindui.react.json react

    tailwindui-storybook

At this point, you will have new folder called output/tailwindui-react where it contains the stories and components. You can copy this folder to your repo and connect it to storybook.

Here's how the structure looks like once connected to Storybook:

tailwindui-storybook

Disclaimer

This tool does not contain any Tailwind UI codes. It only helps you get the codes from tailwindui.com and generate the corresponding story files for your storybook. This means that to use this tool, you need to have a Tailwind UI license and a correct login credentials for tailwindui.com.

No credentials are stored or sent to any third-party endpoints.

**

That's it. Thanks!

tailwindui-storybook's People

Contributors

hahlh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.