|
1 | | -# raw 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="200" height="200" |
| 10 | + src="https://cdn3.iconfinder.com/data/icons/lexter-flat-colorfull-file-formats/56/raw-256.png"> |
| 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>RAW Loader</h1> |
| 16 | +</div> |
4 | 17 |
|
5 | | -`npm install raw-loader` |
| 18 | +<h2 align="center">Install</h2> |
6 | 19 |
|
7 | | -## Usage |
| 20 | +```bash |
| 21 | +npm install --save-dev raw-loader |
| 22 | +``` |
| 23 | + |
| 24 | +<h2 align="center">Usage</h2> |
| 25 | + |
| 26 | +**require** |
| 27 | +```js |
| 28 | +const txt = require("raw!./file.txt") |
| 29 | +``` |
| 30 | + |
| 31 | +**webpack.config.js** |
| 32 | +```js |
| 33 | +const txt = require('file.txt') |
| 34 | +``` |
8 | 35 |
|
9 | | -``` javascript |
10 | | -var fileContent = require("raw-loader!./file.txt"); |
11 | | -// => returns file.txt content as string |
| 36 | +```js |
| 37 | +module.exports = { |
| 38 | + module: { |
| 39 | + rules: [ |
| 40 | + { |
| 41 | + test: /\.txt$/, |
| 42 | + use: [ 'raw-loader' ] |
| 43 | + } |
| 44 | + ] |
| 45 | + } |
| 46 | +} |
12 | 47 | ``` |
13 | 48 |
|
14 | | -[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html) |
| 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/raw-loader.svg |
| 64 | +[npm-url]: https://npmjs.com/package/raw-loader |
| 65 | + |
| 66 | +[node]: https://img.shields.io/node/v/raw-loader.svg |
| 67 | +[node-url]: https://nodejs.org |
| 68 | + |
| 69 | +[deps]: https://david-dm.org/webpack/raw-loader.svg |
| 70 | +[deps-url]: https://david-dm.org/webpack/raw-loader |
| 71 | + |
| 72 | +[tests]: http://img.shields.io/travis/webpack/raw-loader.svg |
| 73 | +[tests-url]: https://travis-ci.org/webpack/raw-loader |
15 | 74 |
|
16 | | -## License |
| 75 | +[cover]: https://coveralls.io/repos/github/webpack/raw-loader/badge.svg |
| 76 | +[cover-url]: https://coveralls.io/github/webpack/raw-loader |
17 | 77 |
|
18 | | -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