Giter Site home page Giter Site logo

hymhub / css-to-tailwind Goto Github PK

View Code? Open in Web Editor NEW
330.0 330.0 19.0 2.99 MB

Convert CSS code to Tailwindcss syntax in real time

Home Page: https://hymhub.github.io/css-to-tailwind/

License: MIT License

TypeScript 98.51% JavaScript 0.76% CSS 0.73%
convert-css css-to-tailwind css-to-tailwind-translator

css-to-tailwind's Introduction

๐Ÿ‘‹ Hello World! I am hyminghan.

css-to-tailwind's People

Contributors

hymhub avatar jorgezreik avatar xiaozi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

css-to-tailwind's Issues

`height` not using default values

Love this repo, incredible job with it! I think it has a ton of potential.

If you're accepting community contributions, I could open a PR to fix this myself. Lmk what you think!

Issue

height doesn't use default values in the same way width does.

Reproduction

Taken from the online demo

Input:

* {
    width: 2rem;
    height: 2rem;
}

Output:

w-8
h-[2rem]

Possible Cause

The height configuration has no reference to default values:

val => (isUnit(val) ? `h-${getUnitMetacharactersVal(val, [CustomSelect.vw]) || `[${val}]`}` : '')

On the other hand, the width configuration does:

val => (isUnit(val) ? `w-${(useAllDefaultValues && getRemDefaultVal(val)) || getUnitMetacharactersVal(val, [CustomSelect.vh]) || `[${val}]`}` : '')

Thus, I believe we can fix this issue by using the useAllDefaultValues function in the height configuration as well.

use default values

Could you convert the default values like 0.5rem/8px to 2 for padding for example.

So if you put in:
padding: 0.5rem;

it converts to:
p-2

Same for the margin attribute. Like you did for the width attributes.

css attributes using `css-variables` fails to convert

Hey, that's a nice handy tool. Thanks for the library. Looks the css attributes using css-variables fails to transform. Is it planned, or in progress. Would like to help on this too if tailwind actually supports this. ๐Ÿ˜„

Screenshot 2023-04-28 at 19 05 50

Support output with prefix

Hey this is a handy tool, thank you for building it! Curious if there's a way (or you already have plans to support this) to specify the output should use a given prefix. It's common in large projects that are migrating to Tailwind to use a prefix in the Tailwind config file in order to avoid style conflicts, so I could see it being very useful to have an option to configure this.

box-shadow wrong convertion

If you type a box-shadow in CSS. For example:
box-shadow: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);

It turns into:
[box-shadow:inset_0_2px_4px_0_rgb(0_0_0_/_0.05)]

It should be:
shadow-inner

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.