You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Static asset revisioning by appending content hash to filenames
4
4
> `unicorn.css` → `unicorn-d41d8cd98f.css`
5
5
6
-
**This project is feature complete.**
6
+
**This project is feature complete. PRs adding new features will not be accepted.**
7
7
8
8
Make sure to set the files to [never expire](http://developer.yahoo.com/performance/rules.html#expires) for this to have an effect.
9
9
10
-
11
10
## Install
12
11
13
12
```
14
13
$ npm install --save-dev gulp-rev
15
14
```
16
15
17
-
18
16
## Usage
19
17
20
18
```js
@@ -28,7 +26,6 @@ exports.default = () => (
28
26
);
29
27
```
30
28
31
-
32
29
## API
33
30
34
31
### rev()
@@ -37,8 +34,8 @@ exports.default = () => (
37
34
38
35
#### path
39
36
40
-
Type: `string`<br>
41
-
Default: `rev-manifest.json`
37
+
Type: `string`\
38
+
Default: `'rev-manifest.json'`
42
39
43
40
Manifest file path.
44
41
@@ -48,44 +45,41 @@ Type: `object`
48
45
49
46
##### base
50
47
51
-
Type: `string`<br>
48
+
Type: `string`\
52
49
Default: `process.cwd()`
53
50
54
51
Override the `base` of the manifest file.
55
52
56
53
##### cwd
57
54
58
-
Type: `string`<br>
55
+
Type: `string`\
59
56
Default: `process.cwd()`
60
57
61
58
Override the current working directory of the manifest file.
62
59
63
60
##### merge
64
61
65
-
Type: `boolean`<br>
62
+
Type: `boolean`\
66
63
Default: `false`
67
64
68
65
Merge existing manifest file.
69
66
70
67
##### transformer
71
68
72
-
Type: `object`<br>
69
+
Type: `object`\
73
70
Default: `JSON`
74
71
75
72
An object with `parse` and `stringify` methods. This can be used to provide a
76
73
custom transformer instead of the default `JSON` for the manifest file.
77
74
78
-
79
75
### Original path
80
76
81
77
Original file paths are stored at `file.revOrigPath`. This could come in handy for things like rewriting references to the assets.
82
78
83
-
84
79
### Asset hash
85
80
86
81
The hash of each rev'd file is stored at `file.revHash`. You can use this for customizing the file renaming, or for building different manifest formats.
87
82
88
-
89
83
### Asset manifest
90
84
91
85
```js
@@ -136,7 +130,6 @@ exports.default = () => (
136
130
137
131
You can optionally call `rev.manifest('manifest.json')` to give it a different path or filename.
138
132
139
-
140
133
## Sourcemaps and `gulp-concat`
141
134
142
135
Because of the way `gulp-concat` handles file paths, you may need to set `cwd` and `path` manually on your `gulp-concat` instance to get everything to work correctly:
@@ -157,7 +150,6 @@ exports.default = () => (
157
150
);
158
151
```
159
152
160
-
161
153
## Different hash for unchanged files
162
154
163
155
Since the order of streams are not guaranteed, some plugins such as `gulp-concat` can cause the final file's content and hash to change. To avoid generating a new hash for unchanged source files, you can:
@@ -166,7 +158,6 @@ Since the order of streams are not guaranteed, some plugins such as `gulp-concat
166
158
- Filter unchanged files with [gulp-unchanged](https://github.com/sindresorhus/gulp-changed)
167
159
- Read more about [incremental builds](https://github.com/gulpjs/gulp#incremental-builds)
168
160
169
-
170
161
## Streaming
171
162
172
163
This plugin does not support streaming. If you have files from a streaming source, such as Browserify, you should use [`gulp-buffer`](https://github.com/jeromew/gulp-buffer) before `gulp-rev` in your pipeline:
@@ -188,12 +179,10 @@ exports.default = () => (
188
179
);
189
180
```
190
181
191
-
192
182
## Integration
193
183
194
184
For more info on how to integrate `gulp-rev` into your app, have a look at the [integration guide](integration.md).
195
185
196
-
197
186
## Use gulp-rev in combination with one or more of
198
187
199
188
It may be useful - and necessary - to use `gulp-rev` with other packages to complete the task.
0 commit comments