roman01la / html-to-react-components

Converts HTML pages into React components
https://roman01la.github.io/html-to-react-components/
MIT License
2.13k stars 136 forks source link

Inline styling leaves out "px" with line-height conversions #25

Closed mandajoan closed 6 years ago

mandajoan commented 6 years ago

I have ran the converter a few times and noticed it does not convert 'line-height' accurately. Instead of converting it as with other styling items such as 'width' or 'align' where the value is placed in quotation marks (ex. "35px"), it converts it to number only and leaves out the size value and quotation marks. It does make the conversion to camel case. html2react-texteditorview

example: Plain html style:

html-inline-styling

same file converted using html-to-react-components

html2react-inline-styling

roman01la commented 6 years ago

Hi! Just double checked, you are right. Unfortunately HTML to JSX conversion is done by a separate library so there's no an easy way to solve this issue given the amount of all possible cases for CSS values syntax. Let's leave the issue open for now, and I'll add a note into readme. Thanks!

roman01la commented 6 years ago

Had a bit of time to dig deeper and looks like it is fixed. Try 1.6.2 and let me know if it works for you.

mandajoan commented 6 years ago

I tried running it (After globally installing 1.6.2) and now I get this error with the react-dom dependency: image

I uninstalled and migrated back to 1.6.1 and it worked fine. So there's just an issue with 1.6.2 with that package.

roman01la commented 6 years ago

please try 1.6.3

mandajoan commented 6 years ago

it worked like a charm :) thank you!