Closed justin808 closed 9 years ago
Hi @justin808, I went through a large integration project using Lineman + Rails; while I don't remember everything and I don't have access to the code anymore here's some of the highlights and pain points I can remember:
bootstrap.rb
to hook into the right time to process assets with lineman so as not to negatively impact peoples workflow who don't touch frontend assets and don't want to have to use both lineman run
and bundle exec rails server
at the same time ; YMMV :Pgrunt-contrib-copy
targets to config/application.{js,coffee}
that will move assets from linemans generated
folder into rails' public/assets
.
I'm trying to make this tutorial (https://github.com/justin808/react-rails-tutorial/tree/react) work with lineman.
I've created this repo: https://github.com/justin808/react-tutorial-lineman. The commit history shows the steps I've taken. I've followed the basic steps listed in the http://linemanjs.com/ page.
On a side note, I'd like to be able to publish assets to rails non-minified, and then use rails to minify before publishing. Any idea on how to do this or why it's not necessary?
Any help is greatly appreciated.
Justin
Posted to Ruby Rogues Forum
Has anybody on this forum tried out either of Webpack or Lineman? I'm trying to figure out the best way to use React in a Rails project. I built this tutorial using the react-rails gem and I'd like to make these other options work using an alternative.
Why an alternative? There are many projects, such as React-Bootstrap that have npm or bower modules. So far, my best, simplest option is to hope the module supports globals and to then manually copy the js file over to the vendor directory. I've been trying all the other alternatives, but, my lack of familiarity with the Javascript toolchain suggests that it will be a fairly big investment to go beyond using the ra.
I do, however, like the concept of being able to prototype JS heavy client side screens without Rails. I've been using the default react-tutorial setup, adding a few pages of my own, as well as jsFiddle (example here).
Webpack
Couple articles on Webpack:
Lineman