-
Notifications
You must be signed in to change notification settings - Fork 378
Move jQuery and jQuery-ujs under /client and npm #88
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
Changes from all commits
879ecb2
6beab23
2ace443
78de2cb
851dc3c
208dc62
421cef2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,8 +18,10 @@ gem "coffee-rails" | |
| # See https://github.com/sstephenson/execjs#readme for more supported runtimes | ||
| # gem "therubyracer", platforms: :ruby | ||
|
|
||
| # Use jquery as the JavaScript library | ||
| gem "jquery-rails" | ||
| # jquery as the JavaScript library has been moved under /client and managed by npm. | ||
| # It is critical to not include any of the jquery gems when following this pattern or | ||
| # else you might have multiple jQuery versions. | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks | ||
| gem "turbolinks" | ||
| # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -173,6 +173,17 @@ Be sure to see [assets.rake](https://github.com/shakacode/react-webpack-rails-tu | |
| The `webpack.rails.config.js` file generates client-bundle.js which is then included | ||
| by the Rails asset pipeline. | ||
|
|
||
| ##jQuery with Rails and Webpack | ||
| jQuery and jQuery-ujs are not required within `app/assets/javascript/application.js` | ||
| and have been moved under`/client` and managed by npm. The modules are exposed via entry point | ||
| by `webpack.common.config.js`. | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, possibly the twitter bootstrap javascript should come from npm? |
||
| In `application.js`, it's critical that any libraries that depend on jQuery come after the inclusion | ||
| of the Webpack bundle, such as the twitter bootstrap javascript. | ||
|
|
||
| Please refer to [Considerations for jQuery with Rails and Webpack](http://forum.railsonmaui.com/t/considerations-for-jquery-with-rails-and-webpack/344) for further info. | ||
|
|
||
|
|
||
| ## Sass and images | ||
| 1. The Webpack server loads the images from the **symlink** of the | ||
| `app/assets/images` directory. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,14 +9,11 @@ | |
| // | ||
| // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details | ||
| // about supported directives. | ||
| // | ||
| //= require jquery | ||
| //= require jquery_ujs | ||
|
|
||
| //= require bootstrap-sprockets | ||
|
|
||
| // Important to import jquery_ujs before rails-bundle as that patches jquery xhr to use the authenticity token! | ||
|
|
||
| // Need to be on top to allow Poltergeist test to work with React. | ||
| //= require es5-shim/es5-shim | ||
|
|
||
| // It is important that generated/client-bundle must be before bootstrap since it is exposing jQuery and jQuery-ujs | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| //= require generated/client-bundle | ||
| //= require bootstrap-sprockets | ||
| //= require turbolinks | ||