Skip to content

Commit

Permalink
specify to use json loader
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaracco committed Feb 22, 2017
1 parent 769fdc6 commit a67391f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Shares Rails i18n translations with your javascripts without duplicating content

## Usage

- Install it `npm install rails-translations-webpack-plugin --save-dev`
- Install it with `npm install rails-translations-webpack-plugin --save-dev`
- To access the generated translations remember to install also `json-loader` with `npm install json-loader --save-dev`
- Require it in your `webpack.config.js`:

```js
Expand All @@ -20,6 +21,19 @@ Shares Rails i18n translations with your javascripts without duplicating content
})
]
```
- Add JSON loader in your loaders block:

```js
module: {
loaders: [
{
include : "src",
test : /\.json$/,
loader : 'json-loader'
}
]
}
```
- Now you can require the translations from your code. E.g.

```js
Expand Down

0 comments on commit a67391f

Please sign in to comment.