tailwind-generator
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

tailwind-generator

Convert CSS declarations into tailwind css class names

codecov shields

⚠️ Tailwind version support: >= 3.4.3

Example

Base:

import { gen } from 'tailwind-generator';

const result = gen({
  'align-items': 'flex-start',
  background: '#FFF',
  display: 'flex',
  'flex-direction': 'column',
  gap: '16px',
  padding: '24px',
  width: '1152px',
});

console.log(result);

// {
//   success: 'items-start flex flex-col bg-white gap-[16px] p-6 w-[1152px]',
//   failed: [],
// }

CSS Variables:

import { gen } from 'tailwind-generator';

const result = gen(
  {
    height: 'var(--var-height)',
  },
  {
    'var-height': '12px',
  },
);

console.log(result);

// {
//   success: 'h-3',
//   failed: [],
// }

Readme

Keywords

none

Package Sidebar

Install

npm i tailwind-generator

Weekly Downloads

1

Version

0.0.1

License

none

Unpacked Size

2.03 MB

Total Files

139

Last publish

Collaborators

  • shiyangzhaoa