Skip to content
This repository was archived by the owner on Oct 27, 2020. It is now read-only.

Commit 9ca733c

Browse files
docs(README): standardize (#6)
1 parent a7f3449 commit 9ca733c

File tree

1 file changed

+94
-21
lines changed

1 file changed

+94
-21
lines changed

README.md

Lines changed: 94 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
[![npm][npm]][npm-url]
2+
[![node][node]][node-url]
23
[![deps][deps]][deps-url]
34
[![test][test]][test-url]
45
[![coverage][cover]][cover-url]
56
[![chat][chat]][chat-url]
67

78
<div align="center">
89
<a href="https://webpack.js.org/">
9-
<img width="200" height="200" vspace="" hspace="25" src="https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon-square-big.svg">
10+
<img width="200" height="200" src="https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon-square-big.svg">
1011
</a>
11-
<h1>cache-loader</h1>
12-
<p>Caches the result of following loaders on disk.</p>
12+
<h1>Cache Loader</h1>
13+
<p>Caches the result of following loaders on disk</p>
1314
</div>
1415

1516
<h2 align="center">Install</h2>
@@ -22,42 +23,75 @@ npm install --save-dev cache-loader
2223

2324
Add this loader in front of other (expensive) loaders to cache the result on disk.
2425

25-
Note that there is an overhead for saving the reading and saving the cache file, so only use this loader to cache expensive loaders.
26+
**webpack.config.js**
27+
```js
28+
module.exports = {
29+
module: {
30+
rules: [
31+
{
32+
test: /\.ext$/,
33+
use: [
34+
'cache-loader',
35+
...loaders
36+
],
37+
include: path.resolve('src')
38+
}
39+
]
40+
}
41+
}
42+
```
43+
44+
> ⚠️ Note that there is an overhead for saving the reading and saving the cache file, so only use this loader to cache expensive loaders.
45+
46+
<h2 align="center">Options</h2>
47+
48+
|Name|Type|Default|Description|
49+
|:--:|:--:|:-----:|:----------|
50+
|**`cacheDirectory`**|`{String}`|`path.resolve('.cache-loader')`|Provide a cache directory where cache items should be stored|
2651

2752
<h2 align="center">Examples</h2>
2853

2954
**webpack.config.js**
30-
3155
```js
3256
module.exports = {
3357
module: {
3458
rules: [
3559
{
3660
test: /\.js$/,
37-
include: path.resolve("src"),
3861
use: [
39-
"cache-loader",
40-
"babel-loader"
41-
]
62+
'cache-loader',
63+
'babel-loader'
64+
],
65+
include: path.resolve('src')
4266
}
4367
]
4468
}
4569
}
4670
```
4771

48-
**with options**
72+
### `Options`
4973

74+
**webpack.config.js**
5075
```js
51-
use: [
52-
{
53-
loader: "cache-loader",
54-
options: {
55-
// provide a cache directory where cache items should be stored
56-
cacheDirectory: path.resolve(".cache")
57-
}
58-
},
59-
"babel-loader"
60-
]
76+
module.exports = {
77+
module: {
78+
rules: [
79+
{
80+
test: /\.js$/,
81+
use: [
82+
{
83+
loader: 'cache-loader',
84+
options: {
85+
cacheDirectory: path.resolve('.cache')
86+
}
87+
},
88+
'babel-loader'
89+
],
90+
include: path.resolve('src')
91+
}
92+
]
93+
}
94+
}
6195
```
6296

6397
<h2 align="center">Maintainers</h2>
@@ -69,16 +103,55 @@ use: [
69103
<a href="https://github.com/sokra">
70104
<img width="150" height="150" src="https://github.com/sokra.png?size=150">
71105
</br>
72-
sokra
106+
Tobias Koppers
107+
</a>
108+
</td>
109+
<td align="center">
110+
<a href="https://github.com/bebraw">
111+
<img width="150" height="150" src="https://github.com/bebraw.png?v=3&s=150">
112+
</br>
113+
Juho Vepsäläinen
114+
</a>
115+
</td>
116+
<td align="center">
117+
<a href="https://github.com/d3viant0ne">
118+
<img width="150" height="150" src="https://github.com/d3viant0ne.png?v=3&s=150">
119+
</br>
120+
Joshua Wiens
121+
</a>
122+
</td>
123+
<td align="center">
124+
<a href="https://github.com/sapegin">
125+
<img width="150" height="150" src="https://github.com/sapegin.png?v=3&s=150">
126+
</br>
127+
Artem Sapegin
128+
</a>
129+
</td>
130+
<td align="center">
131+
<a href="https://github.com/michael-ciniawsky">
132+
<img width="150" height="150" src="https://github.com/michael-ciniawsky.png?v=3&s=150">
133+
</br>
134+
Michael Ciniawsky
135+
</a>
136+
</td>
137+
<td align="center">
138+
<a href="https://github.com/evilebottnawi">
139+
<img width="150" height="150" src="https://github.com/evilebottnawi.png?v=3&s=150">
140+
</br>
141+
Alexander Krasnoyarov
73142
</a>
74143
</td>
75144
</tr>
76145
<tbody>
77146
</table>
78147

148+
79149
[npm]: https://img.shields.io/npm/v/cache-loader.svg
80150
[npm-url]: https://npmjs.com/package/cache-loader
81151

152+
[node]: https://img.shields.io/node/v/cache-loader.svg
153+
[node-url]: https://nodejs.org
154+
82155
[deps]: https://david-dm.org/webpack-contrib/cache-loader.svg
83156
[deps-url]: https://david-dm.org/webpack-contrib/cache-loader
84157

0 commit comments

Comments
 (0)