Skip to content

Commit 4b6e30f

Browse files
authored
Merge pull request #497 from searls/patch-1
Add Rails 5.1 / webpacker instructions
2 parents 4849eca + fcd8a33 commit 4b6e30f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

+15
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,21 @@ Installation using npm.
4747

4848
Run `npm install --save jquery-ujs` to install the jquery-ujs package.
4949

50+
Installation using Rails and Webpacker
51+
------------
52+
53+
If you're using [webpacker](https://github.com/rails/webpacker) (introduced in [Rails 5.1](http://edgeguides.rubyonrails.org/5_1_release_notes.html#optional-webpack-support)) to manage JavaScript assets, then you can add the jquery-ujs npm package to your project using the [yarn](https://yarnpkg.com/en/) CLI.
54+
55+
```
56+
$ yarn add jquery-ujs
57+
```
58+
59+
Then, from any of your included files (e.g. `app/javascript/packs/application.js`, or from a JavaScript file imported by such a pack), you need only import the package for jquery-ujs to be initialized:
60+
61+
```js
62+
import {} from 'jquery-ujs'
63+
```
64+
5065
Installation using Bower
5166
------------
5267

0 commit comments

Comments
 (0)