0.5.0 โ€ข Published 9 months ago

tailwindcss-ts v0.5.0

Weekly downloads
-
License
ISC
Repository
github
Last release
9 months ago

โš ๏ธ Important note

The package still in its early stage and not ready for large scale use. The current versions only for testing the feasibility of that package

We are happy to hear from you all! For any recommendation or feedback, please find me on twitter @mramadanahmed

๐Ÿ“š Tailwindcss-ts

Tailwindcss-ts follow the simple concept of tailwind of generate the utility classes on demand to create a type-safe for it. In addition to utility functions help you to implement your tailwindcss and never use 'className' prop as normal string. The main focus of tailwindcss-ts library is consider your custom tailwindcss configuration ...Read more

๐Ÿš€ Get Started

  1. Once you have your website ready with tailwindcss installed
  2. Install and run tailwind-ts
    npm i tailwindcss-ts@latest
  3. Run generate clis
    npx tailwindcss-ts
  4. Once it is done, src/tws folder will be generated on the root with the tailwind types and utilities for creating your classes
  5. In tailwind.config.js modify the content property to watch only the files of type ./src/**/*.tws.ts
  6. Create as many as tws.ts files as following

     import tws from "./tws";
    
     export const styles = tws.twsCreateStyleSheet({
         title: ["p-9", "text-amber-400"],
         subTitle: {
             default: ["text-green-300"],
             hover: ["hover:text-amber-700"],
             md: ["md:!text-black"],
             "2xl": ["2xl:mb-1"],
         },
     });
  7. Start using your styles as following

     import { styles } from "./App.tws";
    
     function App() {
         return (
             <div className={styles.title}>
             Hello World
             <div className={styles.subTitle}>Subtitle</div>
             </div>
         );
     }
    
     export default App;

๐ŸŽ›๏ธ Features

  1. Type-safe
  2. Tailwind Custom Configuration
  3. Variants
  4. Conditional Styles

โš™๏ธ Configuration

Create a file with name tws.json so you can customize tailwindcss-ts main functionality as following

{
  "tailwindConfig": "./tailwind.config.js",
  "tempDir":"./tws-temp"
  "outputSrc": "./src/tws",
  "customClasses": [
    "pt-[150px]"
  ]
}

๐Ÿฅท Contributions

Every one is welcomed to contribute on that package by raising a PR. Here is steps to run it locally 1. Clone the github repo 2. Run pnpm i 3. Run pnpm start

๐Ÿงต Bugs, Issues and Feedback

Please submit a new issue at github for any kind of discussion related to that package. Looking forward to get in touch very soon

0.5.0

9 months ago

0.4.0

9 months ago

0.3.1

10 months ago

0.3.0

10 months ago

0.2.0

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago

0.0.38

10 months ago

0.0.37

10 months ago

0.0.36

10 months ago

0.0.35

10 months ago

0.0.33

10 months ago

0.0.31

10 months ago

0.0.30

10 months ago

0.0.28

10 months ago

0.0.27

10 months ago

0.0.26

10 months ago

0.0.25

10 months ago

0.0.24

10 months ago

0.0.23

10 months ago

0.0.22

10 months ago

0.0.21

10 months ago

0.0.20

10 months ago

0.0.19

10 months ago

0.0.18

10 months ago

0.0.17

10 months ago

0.0.16

10 months ago

0.0.14

10 months ago

0.0.13

10 months ago

0.0.12

10 months ago

0.0.11

10 months ago

0.0.10

10 months ago

0.0.9

10 months ago

0.0.8

10 months ago

0.0.7-beta

10 months ago

0.0.6-beta

10 months ago

0.0.5-beta

10 months ago

0.0.4-beta

10 months ago

0.0.3-beta

10 months ago

0.0.2-beta

10 months ago

0.0.1-beta

10 months ago