• Stars
    star
    758
  • Rank 59,918 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

tailwindui-crawler downloads the component HTML files locally

tailwindui-crawler

All Contributors

This script will crawl the tailwindui.com website and download all the components to the ./output folder.

🛠 How to use

To install, clone this repo and run yarn or npm install to pull down the dependencies.

Then create a .env file with your email, password, and optional output folder.

EMAIL=youremail
PASSWORD=yourpassword
# OUTPUT optional, defaults to ./output
OUTPUT=/path/to/output
# LANGUAGES defaults to html
LANGUAGES=html,react,vue,alpine
# COMPONENTS commma-delimited list (defaults to all)
COMPONENTS=(all|marketing,application-ui,ecommerce)
# BUILDINDEX generate index file to view components offline
BUILDINDEX=(0 | 1)
# TEMPLATES download template files
TEMPLATES=(0 | 1)

NOTE: The tool uses dotenv-expand to support variable expansion like $HOME/path/to/output so if your password or any other value includes a $, make sure you add a \ (backslash) to escape the $. For example, PASSWORD=p@\$\$w0rd

Also, dotenv does not support inline comments, so do not do something like LANGUAGES=html,react,vue # some comment as it will not get the correct values.

Then finally, run yarn start or npm start

The script will login to tailwindui.com with your credentials, and download all the components as individual files in the ./output folder.

🤔 What's it for?

The benefit of pulling down all the components is that you can commit them to a local or private repo, and by running this periodically, you can see exactly which files were added or changed. Hopefully, some time in the future, they will open up a private repo for those that have purchased the library.

🚀 New v4.0

The crawler has been updated to support the new Tailwind UI site as of 2022-06-27. You can also download the new Page Templates. Add TEMPLATES=1 to your .env file. If you are using the GitHub action to crawl, you will need to update your deploy.yml. See instructions below.

The crawler now supports the new Tailwind UI site and can download HTML, React and Vue versions of the components.

You can also download the "alpine" version of the components. ⚠️ WARNING: the alpine code is NOT production ready. It does not support accesibility and is used to show a preview of how the component interactivity can be implemented.

It also adds the ability to generate an index page that emulates the tailwindui.com website so you can browse components offline.

🗂 Preview page

You can set the .env key BUILDINDEX=1 to have the crawler generate an index file similar to the components page on tailwindui.com. Install and run the serve package to view the index.

NOTE: The HTML Preview does not apply transformers. It's a copy of the component site on tailwindui.com.

yarn global add serve
cd $OUTPUT/preview # change to your preview folder
serve

⚙️ Example .env file

EMAIL=******
PASSWORD=******
OUTPUT=$HOME/Projects/tailwindui
LANGUAGES=html,react,vue,alpine
COMPONENTS=marketing,application-ui
BUILDINDEX=1
TEMPLATES=1

🤖 Automatically keep a private GitHub Repository up-to-date

NOTE: GitHub action has been updated in v4.0.0. Please make sure your default.yml file is updated with the latest actions.

You can automatically keep a private GitHub repository up-to-date with component changes from TailwindUI by using this tool with GitHub Actions.

  1. Create a private GitHub repository.

  2. Add TAILWINDUI_EMAIL and TAILWINDUI_PASSWORD secrets to the GitHub repository.

  3. Optionally create a .env file with additional settings for the crawler.

  4. Create a new file .github/workflows/default.yml:

    name: Update
    on:
      schedule:
        - cron: '0 0 * * *' # Every day at midnight
    
    jobs:
      update:
        name: Update
        runs-on: ubuntu-latest
        steps:
          - name: Checkout
            uses: actions/checkout@v2
          - name: Run crawler
            uses: kiliman/[email protected]
            with:
              email: ${{ secrets.TAILWINDUI_EMAIL }}
              password: ${{ secrets.TAILWINDUI_PASSWORD }}

    NOTE: Make sure to update to the latest action v1.1.0 to support the crawler v3+

    Read more about the schedule cron syntax in the official GitHub Actions documentation.

    NOTE: if you're creating a new repository or have updated your default branch from master, you will have to specify with branch (and/or current_branch) like so:

    # ...
          - name: Run crawler
            uses: kiliman/[email protected]
            with:
              email: ${{ secrets.TAILWINDUI_EMAIL }}
              password: ${{ secrets.TAILWINDUI_PASSWORD }}
    +         branch: main
    +         current_branch: main

Email Notifications

To be emailed whenever there is a change to a component, simply setup GitHub Notifications on your repository.

🚦 Upgrading to v3.

This is a major change. Unfortunately, v2 will no longer work with the existing site due to the updates they may to add support for React/Vue components. Please also note that the GitHub Action has been updated from v1.0.0 to v1.1.0.

Currently, there is no support for transformers, as the need for them is not as critical since the components don't need to be converted to React or Vue.

NOTE: Since this script is essentially screen scraping, there's the potential of it breaking if the HTML structure changes. I will do my best to keep it in sync with the website.

😍 Thank you

Thanks to Adam and Steve for making an amazing library. This has definitely made creating a UI for my applications a pleasant experience.

Enjoy and let me know if you have any questions.

Kiliman

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Kiliman
Kiliman

💻
Simon Waloschek
Simon Waloschek

💻
Pavel Fomchenkov
Pavel Fomchenkov

💻
Robin Malfait
Robin Malfait

💻
Miguel Piedrafita
Miguel Piedrafita

💻 📖 🤔
Vlad Dumitrescu
Vlad Dumitrescu

📖
C-Bass
C-Bass

💻
Greg Brimble
Greg Brimble

📖 🔧
Yagnik
Yagnik

💻
idebeijer
idebeijer

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

More Repositories

1

operator-mono-lig

Add ligatures to Operator Mono similar to Fira Code
JavaScript
3,191
star
2

remix-flat-routes

Remix package to define routes using the flat-routes convention
TypeScript
659
star
3

remix-typedjson

This package is a replacement for superjson to use in your Remix app. It handles a subset of types that `superjson` supports, but is faster and smaller.
TypeScript
432
star
4

remix-params-helper

This package makes it simple to use Zod with standard URLSearchParams and FormData which are typically used in Remix apps.
TypeScript
238
star
5

rmx-cli

A CLI tool for Remix applications
TypeScript
178
star
6

remix-vite-template

Remix template with Vite, Tailwind CSS, and Fly.io support
TypeScript
134
star
7

shadcn-custom-theme

This tool generate a custom theme similar to the ones created by the [shadcn/ui Themes website](https://ui.shadcn.com/themes). You can specify the primary, secondary, accent, and gray colors. The color name should be one of the default Tailwind color names (e.g. red, green, blue, indigo, etc.)
JavaScript
122
star
8

remix-hydration-fix

Sample app that shows how to fix React hydration issues in a Remix app
TypeScript
112
star
9

remix-express-vite-plugin

This package includes a Vite plugin to use in your Remix app. It configures an Express server for both development and production using TypeScript.
TypeScript
101
star
10

remix-component-data

This is a proof of concept for showing how you can expose loader functions from your components to use in your routes.
TypeScript
81
star
11

remix-superjson

Sample showing how to use superjson in your Remix app and full fidelity types with inference
TypeScript
39
star
12

remix-mount-routes

Package for mounting Remix app to non-root routes
TypeScript
37
star
13

remix-scoped-params

Project showing how to track params across multiple routes by scope
TypeScript
36
star
14

remix-global-data

Example showing how to use global data in your Remix app
TypeScript
35
star
15

remix-ecommerce

Remix sample wth product catalog and shopping cart
TypeScript
32
star
16

remix-error-logging

Patch to add server side error logging support to Remix
TypeScript
23
star
17

remix-single-fetch

Remix example showing how to use new Single Data Fetch feature
TypeScript
21
star
18

remix-esbuild-analysis

Includes patch to add --metafile and bundle anaysis support to Remix compiler
15
star
19

remix-workshop

Projects used for the Remix Conf Europe Workshop
TypeScript
15
star
20

epic-stack-with-svg-sprites

Epic Stack example that shows how to use SVG sprites for your React icons
TypeScript
15
star
21

remix-server-folders

Patch to add .server extension to folder in Remix
TypeScript
14
star
22

boron-files

This app is inspired by the Carbon source-code image generator. It enables you to create and share beautiful images of your file list.
TypeScript
13
star
23

remix-vite-express

TypeScript
13
star
24

express-auth-example

TypeScript
13
star
25

epic-stack-time-zone

Epic Stack example with Time Zone client hint
TypeScript
12
star
26

kiliman-dev

TypeScript
12
star
27

remix-component-errorboundary

Example showing how to use `ComponentErrorBoundary`
TypeScript
10
star
28

strip-sourcemaps

CLI to strip server-code from sourcemaps
JavaScript
10
star
29

remix-fastify-app

Test app showing Fastify and Remix integration
JavaScript
10
star
30

remix-walletconnect

Remix example showing how to use WalletConnect with Remix
TypeScript
9
star
31

remix-suspense

Remix example showing how to ensure the Suspense fallback is rendered on route change
TypeScript
9
star
32

remix-blog-mongodb

Remix example that updates the blog tutorial to use MongoDB and Quill
JavaScript
9
star
33

remix-ras-server-example

Sample Remix App Server with custom server file
TypeScript
8
star
34

mono-symbolicate-helper

Helper service to convert obfuscated stack traces to meaningful ones using mono-symbolicate
C#
8
star
35

remix-build-error

A sample app with patches to display build errors in the browser
TypeScript
8
star
36

MvxCommandToMessage

Sample showing how to use a value converter to convert a command into a message
C#
6
star
37

remix-vite-mui

Remix+VIte+MUI example
TypeScript
6
star
38

remix-playground

TypeScript
6
star
39

remix-streams

TypeScript
4
star
40

remix-ftp-deploy

Example to show how to bundle and FTP your Remix app to a host that doesn't let you build
TypeScript
4
star
41

remix-json-fetcher

TypeScript
4
star
42

NuForVS

Nu for Visual Studio
C#
4
star
43

mvx-samples

Some sample apps for MvvmCross
C#
3
star
44

remix-upload

TypeScript
3
star
45

remix-typedjson-example

TypeScript
3
star
46

remix-flat-routes-example

Example site showing the Remix flat routes routing convention
TypeScript
2
star
47

remix-1.15.0-vercel

Remix v1.15.0 Vercel Template
TypeScript
2
star
48

remix-root-errorboundary

Remix example showing root ErrorBoundary
TypeScript
2
star
49

MicrowDB

A mini PCL version of RavenDB client for mobile. Uses SQLite.
C#
2
star
50

epic-stack-theme

Epic Stack example showing how to customize the theme using shadcn-custom-theme tool
TypeScript
2
star
51

remix-js-cookie

Sample showing how to use client-side cookies in Remix
TypeScript
2
star
52

remix-vite-2.2.0

Sample repo using unstable Vite support in Remix
TypeScript
2
star
53

remix-drawer

Example app showing Drawer navigation UI
TypeScript
2
star
54

remix-mount-routes-example

Example showing remix app mounted to non-root URL
TypeScript
1
star
55

epic-stack-kiliman

1
star
56

remix-indie-typedjson

TypeScript
1
star
57

MvxEventsSample

Sample on how to use MvvmCross MvxMessenger plugin with typed Events class
C#
1
star
58

remix-vscode-themes

1
star
59

remix-dnd

JavaScript
1
star
60

remix-docker-test

JavaScript
1
star
61

remix-vite-params

Test repo using Vite and remix-params-helper
TypeScript
1
star
62

remix-vite-2.4.1-pre.2

JavaScript
1
star
63

remix-mapbox

TypeScript
1
star
64

remix-vite-basic

Basic Remix+Vite template with React Canary
TypeScript
1
star
65

remix-custom-domain

Remix example showing how to map custom domain to route param
TypeScript
1
star