Created
June 8, 2015 09:45
-
-
Save barsukov/c3fa7f5973c40ca8e8cd to your computer and use it in GitHub Desktop.
trouble shouting with webpack and rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment