Skip to content

Commit 9ebcf08

Browse files
committed
Promote better the usage options ❤️
1 parent 8da3bc9 commit 9ebcf08

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

README.md

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,45 @@ And (optionally [when branch is enabled](#branch-false)) a `BRANCH` such as:
4646
master
4747
```
4848

49+
## Path Substitutions
50+
51+
It is also possible to use [path substituitions](http://webpack.github.io/docs/configuration.html#output-filename) on build to get the revision, version or branch as part of output paths.
52+
53+
- `[git-revision-version]`
54+
- `[git-revision-hash]`
55+
- `[git-revision-branch]` (only [when branch is enabled](#branch-false))
56+
57+
Example:
58+
59+
```javascript
60+
module.exports = {
61+
output: {
62+
publicPath: 'http://my-fancy-cdn.com/[git-revision-version]/',
63+
filename: '[name]-[git-revision-hash].js'
64+
}
65+
}
66+
```
67+
68+
## Plugin API
69+
70+
The `VERSION`, `COMMITHASH` and `BRANCH` are also exposed through a public API.
71+
72+
Example using the [DefinePlugin](http://webpack.github.io/docs/list-of-plugins.html#defineplugin):
73+
74+
```javascript
75+
var gitRevisionPlugin = new GitRevisionPlugin()
76+
77+
module.exports = {
78+
plugins: [
79+
new DefinePlugin({
80+
'VERSION': JSON.stringify(gitRevisionPlugin.version()),
81+
'COMMITHASH': JSON.stringify(gitRevisionPlugin.commithash()),
82+
'BRANCH': JSON.stringify(gitRevisionPlugin.branch()),
83+
})
84+
]
85+
}
86+
```
87+
4988
## Configuration
5089

5190
The plugin requires no configuration by default, but it is possible to configure it to support custom git workflows.
@@ -129,42 +168,3 @@ module.exports = {
129168
]
130169
}
131170
```
132-
133-
## Path Substitutions
134-
135-
It is also possible to use two [path substituitions](http://webpack.github.io/docs/configuration.html#output-filename) on build to get either the revision or version as part of output paths.
136-
137-
- `[git-revision-version]`
138-
- `[git-revision-hash]`
139-
- `[git-revision-branch]` (only [when branch is enabled](#branch-false))
140-
141-
Example:
142-
143-
```javascript
144-
module.exports = {
145-
output: {
146-
publicPath: 'http://my-fancy-cdn.com/[git-revision-version]/',
147-
filename: '[name]-[git-revision-hash].js'
148-
}
149-
}
150-
```
151-
152-
## Plugin API
153-
154-
The `VERSION`, `COMMITHASH` and `BRANCH` are also exposed through a public API.
155-
156-
Example using the [DefinePlugin](http://webpack.github.io/docs/list-of-plugins.html#defineplugin):
157-
158-
```javascript
159-
var gitRevisionPlugin = new GitRevisionPlugin()
160-
161-
module.exports = {
162-
plugins: [
163-
new DefinePlugin({
164-
'VERSION': JSON.stringify(gitRevisionPlugin.version()),
165-
'COMMITHASH': JSON.stringify(gitRevisionPlugin.commithash()),
166-
'BRANCH': JSON.stringify(gitRevisionPlugin.branch()),
167-
})
168-
]
169-
}
170-
```

0 commit comments

Comments
 (0)