Skip to content
This repository has been archived by the owner on Oct 22, 2019. It is now read-only.

Latest commit

 

History

History
31 lines (24 loc) · 1.24 KB

README.md

File metadata and controls

31 lines (24 loc) · 1.24 KB

webpack-rails-demo

This repository demonstrates basic use of webpack-rails in a Rails 4.2 application.

Even though it demonstrates webpack-rails coexisting with sprockets, sprockets is not required or used by webpack-rails.

Usage

git clone https://github.com/mipearson/webpack-rails-demo.git
cd webpack-rails-demo
bundle install
npm install
foreman start

Then open localhost:3000 in your browser. If everything is working, you should see "Sprockets works!" and "Webpack works!"

Steps Taken

  1. Created new rails project: rails new --skip-keeps --skip-active-record --skip-spring --skip-turbolinks --skip-test-unit webpack-rails-demo
  2. Remove files, gems unnecessary for the demo
  3. Added webpack-rails to the Gemfile and ran bundle install
  4. Ran bundle exec rails generate webpack_rails:install
  5. Added controller, routes and views for "Welcome" page
  6. Added sprockets-based javascript for "Welcome" page
  7. Edited webpack/application.js
  8. Added *webpack_asset_paths to index.html.erb to load webpacked javascript
  9. Ran foreman start
  10. Opened localhost:3000, confirmed that both Sprockets & Webpack are loaded