Skip to content
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

react-rails in Jekyll #634

Closed
1 of 4 tasks
schoenwaldnils opened this issue Nov 11, 2016 · 2 comments
Closed
1 of 4 tasks

react-rails in Jekyll #634

schoenwaldnils opened this issue Nov 11, 2016 · 2 comments

Comments

@schoenwaldnils
Copy link

Help us help you! Please choose one:

  • My app crashes with react-rails, so I've included the stack trace and the exact steps which make it crash.
  • My app doesn't crash, but I'm getting unexpected behavior. So, I've described the unexpected behavior and suggested a new behavior.
  • I'm trying to use react-rails with another library, but I'm having trouble. I've described my JavaScript management setup (eg, Sprockets, Webpack...), how I'm trying to use this other library, and why it's not working.
  • I have another issue to discuss.

Hi there,

is there a way to use this in an Jekyll-enviroment?
I'm looking for a way to prerender react-components using Jekyll, but can't find any good way to do this. I hope this gem could help there.

@rmosolgo
Copy link
Member

rmosolgo commented Dec 9, 2016

I don't think it will be very easy to use this with Jekyll but I can point you towards a few of the building blocks!

If you want to transform JSX with Ruby, have a look at https://github.com/babel/ruby-babel-transpiler.

If you want to render components with Ruby, check out the ExecJSRenderer. It starts an ExecJS context, loads React.js, then uses the context to render React components.

If you want to mount components on an HTML page, have a look at the ReactRailsUJS, which mounts components into placeholder divs: https://github.com/reactjs/react-rails/tree/master/lib/assets/javascripts

I hope that helps! Feel free to reopen if you have specific questions about any of those.

@rmosolgo rmosolgo closed this as completed Dec 9, 2016
@fernandes
Copy link

@rmosolgo thank you for replying this issue, I found this command a little late (about 1 and a half year hahah), but I used this as an inspiration to get SSR working on jekyll... if someone is interested, just check this repo, thank you! 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants