Options
All
  • Public
  • Public/Protected
  • All
Menu

Number representing a enum value of regexKind
--or--
String representing a enum value of regexKind
--or--
Complete or partial object matching IMatchOpt options that determine how build_include matches are found. Any omitted values are included from the values of default match MatchBuildInclude

When needed custom expressions can be written into a task using the match option.
match follows the inteface IMatchOpt. Any omitted values are included from the values of default match MatchBuildInclude
It is also possible to merge current matches with new values.
See example below

Note

File level options will always take priority unless override is set to true.

See Examples

See Also: IOpt

MATCH EXAMPLE

Matches built in match rules of MatchBuildIncludeSlash by seting match to string value of regexKind.buildIncludeSlash

bp = new BuildProcess();
const opt = {
  match: 'BuildIncludeSlash'
};
const results = bp.buildInclude('','./includes/replace.txt', opt`);

Matches the following

// BUILD_INCLUDE(filePath)
// BUILD_INCLUDE(filePath)[options]
// BUILD_INCLUDE(filePath)  
[options]

See Also: Class MatchBuildIncludeSlash

MATCH EXAMPLE

Matches built in match rules of MatchBuildIncludeSlash by seting match to numeric value of regexKind.buildIncludeSlash

bp = new BuildProcess();
const opt = {
  match: 3
};
const results = bp.buildInclude('','./includes/replace.txt', opt`);

Matches the following

// BUILD_INCLUDE(filePath)
// BUILD_INCLUDE(filePath)[options]
// BUILD_INCLUDE(filePath)  
[options]

See Also: Class MatchBuildIncludeSlash

MATCH EXAMPLE

Matchs options such as:
# INCLUDE_BUILD(scratch/main.ts)
#include_build(scratch/modules/myfile.ts)

The Regex will example can be see on regexr.com

bp = new BuildProcess();
const opt = {
  match: {
    name: 'include_build',
    parameters: `(?:\\[(.*)\\])?`,
    prefix: '(?:(?:#))[ \\t]*',
    suffix: ''
  }
};
const results = bp.buildInclude('','./includes/replace.txt', opt`);

MATCH EXAMPLE

Matchs options such as:
---- minus_plus[scratch/main.ts] ++++
----minus_plus[scratch/modules/myfile.ts]{options}++++

The Regex will example can be see on regexr.com

NOTE: This match would not be able to apply indent due to the Regular Expression starting at the beginning of line as indicated by the prefix starting with ^.

bp = new BuildProcess();
const opt = {
  match: {
    name: 'minus_plus',
    fileName: `\\[(?:[ ]+)?(?:['"])?(.*?)(?:['"](?:[ ]+)?)?\\]`,
    parameters: `(?:\\{(.*)\\})?`,
    prefix: '^----[ ]*',
    suffix: '(?:(?:[ ]+)?\\+\\+\\+\\+(?:(?:$)|(?:[\\r\\n]+)))',
    options: 'im'
  }
};
const results = bp.buildInclude('','./includes/replace.txt', opt`);

MATCH EXAMPLE

This example shows how match can merge with other built in matches. By setting kind value to buildIncludeHtml this match will match all the values of MatchBuildIncludeHtml excpet will match on name BUILD_HTML instead of default value of MatchBuildIncludeHtml.name which is BUILD_INCLUDE.

Matchs options such as:
<!-- BUILD_HTML(scratch/main.ts) -->
<!-- BUILD_HTML(scratch/modules/myfile.ts) -->

bp = new BuildProcess();
const opt = {
  match: {
    kind: 'buildIncludeHtml',
    name: 'BUILD_HTML'
  }
};
const results = bp.buildInclude('','./includes/replace.txt', opt`);

Build-include Options

Generated using TypeDoc