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

Possible to decide data-components automatically? #37

Closed athityakumar closed 5 years ago

athityakumar commented 5 years ago

First of all, kudos for creating this project! ❤️

When dealing with a huge template with multiple pages of HTML content with no annotated data-components attribute, would it be possible to automatically decide the components (like, split into very very granular level). I mean, I'd be happier being served LOTs of trivially-small components as the default functionality (ie, when no data-components is specified) rather than ending up with 0 components.

Am I missing something? Is this feature already existent?

roman01la commented 5 years ago

This doesn't exist and I don't see how this can be done such that it pleases everyone. If you want one component per DOM node you can run a small script in the browser before copying html that will add data attribute to every DOM node.

athityakumar commented 5 years ago

RIght, that'd be my required feature - but as I said, that'd be kinda tedious to execute for a huge template with lots of HTML files. Rather, I feel it'd help to have as default functionality when there's no mention of data-component anywhere. 😅

roman01la commented 5 years ago

Default behavior is not gonna change. That said, you can always have a pre pass built elsewhere in user land.

athityakumar commented 5 years ago

Ah okay, no problem! 👍