Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/etareduction/clamp-tailwind

CLI tool that merges your react/tailwind codebase className's into per-component CSS modules.
https://github.com/etareduction/clamp-tailwind

babel css css-modules cssmodules react reactjs tailwindcss

Last synced: about 13 hours ago
JSON representation

CLI tool that merges your react/tailwind codebase className's into per-component CSS modules.

Awesome Lists containing this project

README

        

## **WARNING!** Currently it overwrites source files, that's intentional. Make sure to save backups!

### How it works:

- Install the CLI tool from NPM registry:
```bash
npm i -g clamp-tailwind
```

- Run it providing path to directory that contains `.tsx` source files:
```bash
clamp-tailwind path/to/directory
```
- Such input source code:
```tsx
// Button.tsx

import type { FC } from 'react'

const Button: FC = () =>



export default Button
```
Will result in such output:
```tsx
// Button.tsx

import styles from './Button.module.css'
import type { FC } from 'react'

const Button: FC = () =>


export default Button
```
```css
/* Button.module.css */

.div {
@apply w-10 h-10 bg-red-900;
}
```
---

Jest tests included:
```bash
npm test
```