git-revision-webpack-plugin
Advanced tools
Comparing version 2.5.0 to 2.5.1
{ | ||
"name": "git-revision-webpack-plugin", | ||
"version": "2.5.0", | ||
"version": "2.5.1", | ||
"description": "Simple webpack plugin that generates VERSION and COMMITHASH files during build", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -49,2 +49,41 @@ # Git Revision Webpack Plugin | ||
## Path Substitutions | ||
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. | ||
- `[git-revision-version]` | ||
- `[git-revision-hash]` | ||
- `[git-revision-branch]` (only [when branch is enabled](#branch-false)) | ||
Example: | ||
```javascript | ||
module.exports = { | ||
output: { | ||
publicPath: 'http://my-fancy-cdn.com/[git-revision-version]/', | ||
filename: '[name]-[git-revision-hash].js' | ||
} | ||
} | ||
``` | ||
## Plugin API | ||
The `VERSION`, `COMMITHASH` and `BRANCH` are also exposed through a public API. | ||
Example using the [DefinePlugin](http://webpack.github.io/docs/list-of-plugins.html#defineplugin): | ||
```javascript | ||
var gitRevisionPlugin = new GitRevisionPlugin() | ||
module.exports = { | ||
plugins: [ | ||
new DefinePlugin({ | ||
'VERSION': JSON.stringify(gitRevisionPlugin.version()), | ||
'COMMITHASH': JSON.stringify(gitRevisionPlugin.commithash()), | ||
'BRANCH': JSON.stringify(gitRevisionPlugin.branch()), | ||
}) | ||
] | ||
} | ||
``` | ||
## Configuration | ||
@@ -133,40 +172,1 @@ | ||
``` | ||
## Path Substitutions | ||
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. | ||
- `[git-revision-version]` | ||
- `[git-revision-hash]` | ||
- `[git-revision-branch]` (only [when branch is enabled](#branch-false)) | ||
Example: | ||
```javascript | ||
module.exports = { | ||
output: { | ||
publicPath: 'http://my-fancy-cdn.com/[git-revision-version]/', | ||
filename: '[name]-[git-revision-hash].js' | ||
} | ||
} | ||
``` | ||
## Plugin API | ||
The `VERSION`, `COMMITHASH` and `BRANCH` are also exposed through a public API. | ||
Example using the [DefinePlugin](http://webpack.github.io/docs/list-of-plugins.html#defineplugin): | ||
```javascript | ||
var gitRevisionPlugin = new GitRevisionPlugin() | ||
module.exports = { | ||
plugins: [ | ||
new DefinePlugin({ | ||
'VERSION': JSON.stringify(gitRevisionPlugin.version()), | ||
'COMMITHASH': JSON.stringify(gitRevisionPlugin.commithash()), | ||
'BRANCH': JSON.stringify(gitRevisionPlugin.branch()), | ||
}) | ||
] | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20328