Skip to content

Commit 4b5675a

Browse files
committed
Document the new configuration options 😎
1 parent 667543b commit 4b5675a

1 file changed

Lines changed: 43 additions & 3 deletions

File tree

README.md

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,59 @@ And a `COMMITHASH` such as:
3939
7c16d8b1abeced419c14eb9908baeb4229ac0542
4040
```
4141

42+
## Configuration
43+
44+
The plugin requires no configuration by default, but it is possible to configure it to support custom git workflows.
45+
46+
### `lightweightTags: true`
47+
4248
If you need [lightweight tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging#Lightweight-Tags) support, you may turn on `lighweithTags` option in this way:
4349

4450
```javascript
4551
var GitRevisionPlugin = require('git-revision-webpack-plugin')
4652

4753
module.exports = {
4854
plugins: [
49-
new GitRevisionPlugin({ lightweightTags: true })
55+
new GitRevisionPlugin({
56+
lightweightTags: true
57+
})
58+
]
59+
}
60+
```
61+
62+
### `commithashCommand: 'rev-parse HEAD'`
63+
64+
To change the default `git` command used to read the value of `COMMITHASH`:
65+
66+
```javascript
67+
var GitRevisionPlugin = require('git-revision-webpack-plugin')
68+
69+
module.exports = {
70+
plugins: [
71+
new GitRevisionPlugin({
72+
commithashCommand: 'rev-list --max-count=1 --no-merges HEAD'
73+
})
74+
]
75+
}
76+
```
77+
78+
### `versionCommand: 'describe --always'`
79+
80+
To change the default `git` command used to read the value of `VERSION`:
81+
82+
```javascript
83+
var GitRevisionPlugin = require('git-revision-webpack-plugin')
84+
85+
module.exports = {
86+
plugins: [
87+
new GitRevisionPlugin({
88+
versionCommand: 'describe --always --tags --dirty'
89+
})
5090
]
5191
}
5292
```
5393

54-
### Path Substitutions
94+
## Path Substitutions
5595

5696
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.
5797

@@ -69,7 +109,7 @@ module.exports = {
69109
}
70110
```
71111

72-
### Public API
112+
## Plugin API
73113

74114
The `VERSION` and `COMMITHASH` are also exposed through a public API.
75115

0 commit comments

Comments
 (0)