mirror of
https://github.com/locomotivemtl/locomotive-boilerplate.git
synced 2026-01-15 00:55:08 +08:00
Improve asset versioning task
Improved logic for replacing the value to allow for simpler regular expression patterns. Lookbehinds and lookaheads are no longer required.
This commit is contained in:
@@ -387,7 +387,7 @@ The regular expression can be a `RegExp` object or a pattern prefixed with `rege
|
||||
|
||||
* ```json
|
||||
{
|
||||
"key": "regexp:(?<=^const ASSETS_VERSION = ')(?<version>\\d+)(?=';$)"
|
||||
"key": "regexp:(?<=^const ASSETS_VERSION = ')(?<build>\\d+)(?=';$)"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -398,10 +398,14 @@ The regular expression can be a `RegExp` object or a pattern prefixed with `rege
|
||||
```
|
||||
* ```js
|
||||
{
|
||||
key: /(?<=\bconst ASSETS_VERSION = )[^;]+/
|
||||
key: /^ \* Version: +(?:.+?)\+(.+?)$/
|
||||
}
|
||||
```
|
||||
|
||||
The regular expression pattern will match the first occurrence and replace
|
||||
the first match in the following order: `build` (named capture), `version`
|
||||
(named capture), `1` (first capture), or `0` (whole match).
|
||||
|
||||
See [`versions.js`](../build/tasks/versions.js) for details.
|
||||
|
||||
[Autoprefixer]: https://npmjs.com/package/autoprefixer
|
||||
|
||||
Reference in New Issue
Block a user