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

Commit b5ea427

Browse files
committed
chore(readme): Update to webpack standard format
1 parent 1462d4b commit b5ea427

File tree

2 files changed

+115
-14
lines changed

2 files changed

+115
-14
lines changed

.github/assets/file_loader_icon.svg

+36
Loading

README.md

+79-14
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,37 @@
1-
# file 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]
7+
8+
<div align="center">
9+
<img width="200" height="200"
10+
src="https://cdn.rawgit.com/webpack/file-loader/tree/master/.github/assets/file_loader_icon.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>File Loader</h1>
16+
</div>
17+
18+
<h2 align="center">Install</h2>
19+
20+
```bash
21+
npm install --save-dev file-loader
22+
```
223

3-
## Usage
24+
<h2 align="center">Usage</h2>
425

5-
[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html)
26+
By default the filename of the resulting file is the MD5 hash of the file's contents
27+
with the original extension of the required resource.
628

729
``` javascript
830
var url = require("file-loader!./file.png");
931
// => emits file.png as file in the output directory and returns the public url
1032
// => returns i. e. "/public-path/0dcbbaa701328a3c262cfd45869e351f.png"
1133
```
1234

13-
By default the filename of the resulting file is the MD5 hash of the file's contents
14-
with the original extension of the required resource.
15-
1635
By default a file is emitted, however this can be disabled if required (e.g. for server
1736
side packages).
1837

@@ -22,7 +41,7 @@ var url = require("file-loader?emitFile=false!./file.png");
2241
// => returns i. e. "/public-path/0dcbbaa701328a3c262cfd45869e351f.png"
2342
```
2443

25-
## Filename templates
44+
#### Filename templates
2645

2746
You can configure a custom filename template for your file using the query parameter `name`. For instance, to copy a file from your `context` directory into the output directory retaining the full directory structure, you might use `?name=[path][name].[ext]`.
2847

@@ -31,10 +50,10 @@ By default, the path and name you specify will output the file in that same dire
3150
You can specify custom output and public paths by using the `outputPath` and `publicPath` query name parameters:
3251

3352
```
34-
loader: "file-loader?name=[name].[ext]&publicPath=assets/foo/&outputPath=app/images/"
53+
use: "file-loader?name=[name].[ext]&publicPath=assets/foo/&outputPath=app/images/"
3554
```
3655

37-
### Filename template placeholders
56+
#### Filename template placeholders
3857

3958
* `[ext]` the extension of the resource
4059
* `[name]` the basename of the resource
@@ -46,7 +65,7 @@ loader: "file-loader?name=[name].[ext]&publicPath=assets/foo/&outputPath=app/ima
4665
* and `length` the length in chars
4766
* `[N]` the N-th match obtained from matching the current file name against the query param `regExp`
4867

49-
## Examples
68+
#### Examples
5069

5170
``` javascript
5271
require("file-loader?name=js/[hash].script.[ext]!./javascript.js");
@@ -73,10 +92,56 @@ require("file-loader?name=[path][name].[ext]?[hash]!./dir/file.png")
7392
// => dir/file.png?e43b20c069c4a01867c31e98cbce33c9
7493
```
7594

76-
## Installation
95+
<h2 align="center">Contributing</h2>
96+
97+
Don't hesitate to create a pull request. Every contribution is appreciated. In development you can start the tests by calling `npm test`.
98+
99+
<h2 align="center">Maintainers</h2>
100+
101+
<table>
102+
<tbody>
103+
<tr>
104+
<td align="center">
105+
<img width="150 height="150"
106+
src="https://avatars.githubusercontent.com/sokra?v=3">
107+
<br />
108+
<a href="https://github.com/">Tobias Koppers</a>
109+
</td>
110+
<td align="center">
111+
<img width="150 height="150"
112+
src="https://avatars.githubusercontent.com/SpaceK33z?v=3">
113+
<br />
114+
<a href="https://github.com/">Kees Kluskens</a>
115+
</td>
116+
<td align="center">
117+
<img width="150 height="150"
118+
src="https://avatars.githubusercontent.com/mobitar?v=3">
119+
<br />
120+
<a href="https://github.com/">Mo Bitar</a>
121+
</td>
122+
<tr>
123+
<tbody>
124+
</table>
125+
126+
127+
<h2 align="center">LICENSE</h2>
128+
129+
#### [MIT](./LICENSE)
130+
131+
[npm]: https://img.shields.io/npm/v/file-loader.svg
132+
[npm-url]: https://npmjs.com/package/file-loader
133+
134+
[node]: https://img.shields.io/node/v/file-loader.svg
135+
[node-url]: https://nodejs.org
136+
137+
[deps]: https://david-dm.org/webpack/file-loader.svg
138+
[deps-url]: https://david-dm.org/webpack/file-loader
77139

78-
```npm install file-loader --save-dev```
140+
[tests]: http://img.shields.io/travis/webpack/file-loader.svg
141+
[tests-url]: https://travis-ci.org/webpack/file-loader
79142

80-
## License
143+
[cover]: https://coveralls.io/repos/github/webpack/file-loader/badge.svg
144+
[cover-url]: https://coveralls.io/github/webpack/file-loader
81145

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

0 commit comments

Comments
 (0)