|
1 |
| -# json loader for webpack |
| 1 | +[![npm][npm]][npm-url] |
| 2 | +[![node][node]][node-url] |
| 3 | +[![deps][deps]][deps-url] |
| 4 | +[![tests][tests]][tests-url] |
| 5 | +[![coverage][cover]][cover-url] |
| 6 | +[![chat][chat]][chat-url] |
2 | 7 |
|
3 |
| -## Installation |
| 8 | +<div align="center"> |
| 9 | + <img width="160" height="180" |
| 10 | + src="https://worldvectorlogo.com/logos/json.svg"> |
| 11 | + <a href="https://github.com/webpack/webpack"> |
| 12 | + <img width="200" height="200" |
| 13 | + src="https://webpack.js.org/assets/icon-square-big.svg"> |
| 14 | + </a> |
| 15 | + <h1>JSON Loader</h1> |
| 16 | +</div> |
4 | 17 |
|
5 |
| -`npm install --save json-loader` |
| 18 | +<h2 align="center">Install</h2> |
6 | 19 |
|
7 |
| -## Usage |
| 20 | +```bash |
| 21 | +npm install --save-dev json-loader |
| 22 | +``` |
| 23 | + |
| 24 | +<h2 align="center">Usage</h2> |
| 25 | + |
| 26 | +**require** |
| 27 | +```js |
| 28 | +const json = require("json!./file.json") |
| 29 | +``` |
| 30 | + |
| 31 | +**webpack.config.js** |
| 32 | +```js |
| 33 | +const json = require('file.json') |
| 34 | +``` |
8 | 35 |
|
9 |
| -``` javascript |
10 |
| -var json = require("json-loader!./file.json"); |
11 |
| -// => returns file.json content as json parsed object |
| 36 | +```js |
| 37 | +module.exports = { |
| 38 | + module: { |
| 39 | + rules: [ |
| 40 | + { |
| 41 | + test: /\.json$/, |
| 42 | + use: [ 'json-loader' ] |
| 43 | + } |
| 44 | + ] |
| 45 | + } |
| 46 | +} |
12 | 47 | ```
|
13 | 48 |
|
14 |
| -## License |
| 49 | +<h2 align="center">Maintainer</h2> |
| 50 | + |
| 51 | +<table> |
| 52 | + <tbody> |
| 53 | + <tr> |
| 54 | + <td align="center"> |
| 55 | + <img width="150 height="150" src="https://github.com/sokra.png?s=150"> |
| 56 | + <br> |
| 57 | + <a href="https://github.com/sokra">Tobias Koppers</a> |
| 58 | + </td> |
| 59 | + <tr> |
| 60 | + <tbody> |
| 61 | +</table> |
| 62 | + |
| 63 | +[npm]: https://img.shields.io/npm/v/json-loader.svg |
| 64 | +[npm-url]: https://npmjs.com/package/json-loader |
| 65 | + |
| 66 | +[node]: https://img.shields.io/node/v/json-loader.svg |
| 67 | +[node-url]: https://nodejs.org |
| 68 | + |
| 69 | +[deps]: https://david-dm.org/webpack/json-loader.svg |
| 70 | +[deps-url]: https://david-dm.org/webpack/json-loader |
| 71 | + |
| 72 | +[tests]: http://img.shields.io/travis/webpack/json-loader.svg |
| 73 | +[tests-url]: https://travis-ci.org/webpack/json-loader |
| 74 | + |
| 75 | +[cover]: https://coveralls.io/repos/github/webpack/json-loader/badge.svg |
| 76 | +[cover-url]: https://coveralls.io/github/webpack/json-loader |
15 | 77 |
|
16 |
| -MIT (http://www.opensource.org/licenses/mit-license.php) |
| 78 | +[chat]: https://badges.gitter.im/webpack/webpack.svg |
| 79 | +[chat-url]: https://gitter.im/webpack/webpack |
0 commit comments