-
-
Notifications
You must be signed in to change notification settings - Fork 498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add JSX Engine #235
Comments
Yeah! I think this would be useful. Related, planning on making this easier in #117. |
This repository is now using lodash style issue management for enhancements. This means enhancement issues will now be closed instead of leaving them open. The enhancement backlog can be found here: https://github.com/11ty/eleventy/issues?utf8=%E2%9C%93&q=label%3Aneeds-votes+sort%3Areactions-%2B1-desc+ Don’t forget to upvote the top comment with 👍! |
👍 |
how does react-static do it? |
Here's an example of how to use JSX (or the TypeScript variant, TSX) with Eleventy via JavaScript templates ( https://github.com/ithinkihaveacat/eleventy-jsx (It uses vhtml!) |
Just published a starter kit that uses react components as the default template language https://github.com/signalkuppe/eleventy-react Feedbacks are welcome! |
I've managed to get JSX support using a simple The important bit is here: I'm using Preact in the repo above. Both React and Preact have an Once that's setup you can return JSX from your I've only done this using TypeScript's JSX factory, but I'm sure you could replace that with a Babel transform / plugin. |
I used the new template language support of Eleventy v1.0 to make a plugin that enables JSX support using Babel and the excellent @unifiedjs/@rehypejs ecosystem. Check it out here: https://github.com/j-f1/eleventy-hast-jsx. My hope is that it will be pretty generic but let me know if you need it to do anything else! |
Official docs deploying to https://www.11ty.dev/docs/languages/jsx/ Shipping with 3.0.0-alpha.11 Very open to others adding alternate approaches there, via plugins or otherwise! |
Would you be open to a PR to include JSX as an engine? I think I get the gist for how one would be implemented, looking at the code (but would love any pointers on how to implement).
The idea would be to use ReactDOMServer.renderToStaticMarkup()
The text was updated successfully, but these errors were encountered: