Skip to content

Instantly share code, notes, and snippets.

@barsukov
Created June 8, 2015 09:45
Show Gist options
  • Save barsukov/c3fa7f5973c40ca8e8cd to your computer and use it in GitHub Desktop.
Save barsukov/c3fa7f5973c40ca8e8cd to your computer and use it in GitHub Desktop.

Revisions

  1. barsukov created this gist Jun 8, 2015.
    30 changes: 30 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    1) rails new turbo
    2) rails g scaffold post
    3) rake db:migrate

    IN YO MAN
    mkdir client && cd $_
    yo react-webpack

    1) create client-bundle.js
    2) webpack-dev-server/client?http://localhost:8000 in webpack
    3) output: {
    filename: 'assets/client-bundle.self.js',
    path: __dirname,
    publicPath: 'http://localhost:8000/' // Required for webpack-dev-server
    },
    4) grunt clean webpack-dev-server entry
    5) rails developers.rb
    config.action_controller.asset_host = Proc.new do |source|
    if source =~ /client-bundle/
    "http://localhost:8000/"
    end
    end
    config.assets.digest = false
    7) <div id="content"> </div> “entry point” in Post index
    8) In client app :
    document.addEventListener("DOMContentLoaded", function(event) {
    React.render(<ClientApp />, document.getElementById('content')); // jshint ignore:line
    });
    9)grunt webpack-dev-server