Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 49a8a77

Browse files
evilebottnawimichael-ciniawsky
authored andcommitted
feat: add cache option (options.cache) (#86)
1 parent dc0a554 commit 49a8a77

File tree

4 files changed

+1043
-656
lines changed

4 files changed

+1043
-656
lines changed

README.md

+21-9
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,16 @@ module.exports = {
3737

3838
|Name|Type|Default|Description|
3939
|:--:|:--:|:-----:|:----------|
40-
|**`test`**|`{RegExp\|Array<RegExp>}`|`.`|All assets matching this `{RegExp\|Array<RegExp>}` are processed|
41-
|**`include`**|`{RegExp\|Array<RegExp>}`|`undefined`|Files to `include`|
42-
|**`exclude`**|`{RegExp\|Array<RegExp>}`|`undefined`|Files to `exclude`|
43-
|**`asset`**|`{String}`|`[path].gz[query]`|The target asset name. `[file]` is replaced with the original asset. `[path]` is replaced with the path of the original asset and `[query]` with the query|
44-
|**`filename`**|`{Function}`|`false`|A `{Function}` `(asset) => asset` which receives the asset name (after processing `asset` option) and returns the new asset name|
45-
|**`algorithm`**|`{String\|Function}`|`gzip`|Can be `(buffer, cb) => cb(buffer)` or if a `{String}` is used the algorithm is taken from `zlib`|
46-
|**`threshold`**|`{Number}`|`0`|Only assets bigger than this size are processed. In bytes.|
47-
|**`minRatio`**|`{Number}`|`0.8`|Only assets that compress better than this ratio are processed|
48-
|**`deleteOriginalAssets`**|`{Boolean}`|`false`|Whether to delete the original assets or not|
40+
|**[`test`](#test)**|`{RegExp\|Array<RegExp>}`|`.`|All assets matching this `{RegExp\|Array<RegExp>}` are processed|
41+
|**[`include`](#include)**|`{RegExp\|Array<RegExp>}`|`undefined`|Files to `include`|
42+
|**[`exclude`](#exclude)**|`{RegExp\|Array<RegExp>}`|`undefined`|Files to `exclude`|
43+
|**[`cache`](#cache)**|`{Boolean\|String}`|`false`|Enable file caching|
44+
|**[`asset`](#asset)**|`{String}`|`[path].gz[query]`|The target asset name. `[file]` is replaced with the original asset. `[path]` is replaced with the path of the original asset and `[query]` with the query|
45+
|**[`filename`](#filename)**|`{Function}`|`false`|A `{Function}` `(asset) => asset` which receives the asset name (after processing `asset` option) and returns the new asset name|
46+
|**[`algorithm`](#algorithm)**|`{String\|Function}`|`gzip`|Can be `(buffer, cb) => cb(buffer)` or if a `{String}` is used the algorithm is taken from `zlib`|
47+
|**[`threshold`](#threshold)**|`{Number}`|`0`|Only assets bigger than this size are processed. In bytes.|
48+
|**[`minRatio`](#minratio)**|`{Number}`|`0.8`|Only assets that compress better than this ratio are processed|
49+
|**[`deleteOriginalAssets`](#deleteoriginalassets)**|`{Boolean}`|`false`|Whether to delete the original assets or not|
4950

5051
### `test`
5152

@@ -80,6 +81,17 @@ module.exports = {
8081
]
8182
```
8283

84+
### `cache`
85+
86+
**webpack.config.js**
87+
```js
88+
[
89+
new CompressionPlugin({
90+
cache: true
91+
})
92+
]
93+
```
94+
8395
### `asset`
8496

8597
**webpack.config.js**

0 commit comments

Comments
 (0)