Added support for replacing a string in a file using a regular expression.
The routine uses Node's Readline and Stream modules.
The `outfile` will be renamed with a `~` suffix, then stream each line, writing to a new `outfile`.
On success, the backup file (with `~`) is deleted.
On error, any new file is deleted, then the backup file is renamed without a `~` suffix.
Usage:
```json
"versions": [
{
"format": "timestamp",
"key": "regexp:(?<=\bdefine\('ASSETS_VERSION', )[^\)]+(?=\);)",
"outfile": "src/bootstrap.php"
}
]
```
```php
<?php
define( 'ASSETS_VERSION', 1665071717350 );
```
Changed:
- Bumped NPM requirement.
- Added note about benefits of using NVM.
- Added note about support for PurgeCSS to Styles task.
- Added details about Versions task.
Changed:
- Fixed svg-mixer constraint from `^2.3.14` to `~2.3.14` to stay within `2.3` range since `2.4.0` appears to be an anomaly.
- Overrode postcss constraint in svg-mixer from `^6.0.21` to `^8.4.20` to fix security notice.
Added:
- Support for writing multiple times to the same file.
- Support for random hexadecimal value instead of timestamp.
Usage:
```json
"versions": [
{
"format": "timestamp",
"key": "now",
"outfile": "./assets.json"
},
{
"format": "hex:8",
"key": "hex",
"outfile": "./assets.json"
}
]
```
```json
{
"now": 1665071717350,
"hex": "6ef54181c4ba"
}
```
A task to allow one to define zero or more JSON files and keys to create or update with the current timestamp.
By default, the boilerplate will maintain a './assets.json' file which should be imported by the Web framework and applied to compiled assets.
The code in this commit is not intended for production environments;
it requires further testing.
Added:
- Multiple "Source Sans 3" fonts to test many `FontFace` entries.
Changed:
- Removed quotes from font family name to avoid them being included in `FontFace.family` value.
Notes:
- Replaces hidden `<span>` elements with `FaceFace.load()` and `FaceFace.loaded` to eagerly load fonts.
- Fonts are eagerly using custom `loadFonts()` (see 'app.js').
- Acting upon loaded fonts is done using `whenReady()` (see 'Example.js').