Skip to content
This repository was archived by the owner on Mar 17, 2021. It is now read-only.

Commit 225b823

Browse files
authored
Merge pull request #12 from michael-ciniawsky/readme
docs(README): refactor for webpack v2
2 parents 46146bb + b805ee1 commit 225b823

File tree

1 file changed

+90
-10
lines changed

1 file changed

+90
-10
lines changed

README.md

Lines changed: 90 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,98 @@
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]
27

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+
<h3>A loader for webpack that lets you import files as a string.</h3>
17+
</div>
418

5-
`npm install raw-loader`
19+
<h2 align="center">Install</h2>
620

7-
## Usage
21+
```bash
22+
npm install --save-dev raw-loader
23+
```
24+
25+
<h2 align="center">Usage</h2>
26+
27+
Use the loader either via your webpack config, CLI or inline.
28+
29+
### Via webpack config (recommended)
30+
31+
**webpack.config.js**
32+
```js
33+
module.exports = {
34+
module: {
35+
rules: [
36+
{
37+
test: /\.txt$/,
38+
use: 'raw-loader'
39+
}
40+
]
41+
}
42+
}
43+
```
844

9-
``` javascript
10-
var fileContent = require("raw-loader!./file.txt");
11-
// => returns file.txt content as string
45+
**In your application**
46+
```js
47+
import txt from 'file.txt';
1248
```
1349

14-
[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html)
50+
### CLI
51+
52+
```bash
53+
webpack --module-bind 'txt=raw-loader'
54+
```
55+
56+
**In your application**
57+
```js
58+
import txt from 'file.txt';
59+
```
60+
61+
### Inline
62+
63+
**In your application**
64+
```js
65+
import txt from 'raw-loader!./file.txt';
66+
```
67+
68+
<h2 align="center">Maintainers</h2>
69+
70+
<table>
71+
<tbody>
72+
<tr>
73+
<td align="center">
74+
<img width="150 height="150" src="https://github.com/sokra.png?s=150">
75+
<br>
76+
<a href="https://github.com/sokra">Tobias Koppers</a>
77+
</td>
78+
<tr>
79+
<tbody>
80+
</table>
81+
82+
[npm]: https://img.shields.io/npm/v/raw-loader.svg
83+
[npm-url]: https://npmjs.com/package/raw-loader
84+
85+
[node]: https://img.shields.io/node/v/raw-loader.svg
86+
[node-url]: https://nodejs.org
87+
88+
[deps]: https://david-dm.org/webpack/raw-loader.svg
89+
[deps-url]: https://david-dm.org/webpack/raw-loader
90+
91+
[tests]: http://img.shields.io/travis/webpack/raw-loader.svg
92+
[tests-url]: https://travis-ci.org/webpack/raw-loader
1593

16-
## License
94+
[cover]: https://coveralls.io/repos/github/webpack/raw-loader/badge.svg
95+
[cover-url]: https://coveralls.io/github/webpack/raw-loader
1796

18-
MIT (http://www.opensource.org/licenses/mit-license.php)
97+
[chat]: https://badges.gitter.im/webpack/webpack.svg
98+
[chat-url]: https://gitter.im/webpack/webpack

0 commit comments

Comments
 (0)