markdalgleish / react-to-html-webpack-plugin

Webpack plugin that renders React components to HTML files
MIT License
168 stars 14 forks source link

Wrap with standard HTML page declaration? #1

Closed bebraw closed 9 years ago

bebraw commented 9 years ago

html-webpack-plugin wraps output in standard HTML. Maybe doing that would be a good idea here as well.

I wonder if there would be some way to merge the output of plugins somehow, though. It would be very useful to get valid HTML with React expanded to HTML etc. out of Webpack.

bebraw commented 9 years ago

Actually now that I think of it, perhaps it would be ideal if it was possible to inject the output of react-to-html-webpack-plugin within html-webpack-plugin. Generating HTML wrapper here might be a bit too much if it's possible to do it this way.

markdalgleish commented 9 years ago

My current approach is to render the entire page from a React component: https://github.com/markdalgleish/react-progressive-component-starter/blob/master/demo/Demo.jsx — would this work for you?

The main drawback with this approach is that you can't know ahead of time what the assets are going to be, so you have to hard code them in. I'll probably try to solve this problem in the near future.

bebraw commented 9 years ago

My goal here would be to get something SEO friendly for a component of mine. Now the base index.html is very simple and the content of my demo site is constructed by React dynamically.

Ideally it should be possible to generate index.html that would contain HTML structure for React to pick up. That is why it seems to me there should be some way to make this work with html-webpack-plugin.

In addition I would love to be able to render Markdown to HTML structure too but that's beyond this issue.