Build-Include has a primary purpose of reading input file and finding matching build-include statements that are parsed and replaced with the actual contents.
main.js includes in it contents the following line
// BUILD_INCLUDE(./includes/replaceComment.txt)
const bp = new BuildProcess();
const opt = {
match: {
kind: "buildIncludeSlash"
}
};
const results = bp.buildInclude('','./lib/main.js', opt);
The // BUILD_INCLUDE in main.js will be replaced with the contents of replaceComment.txt.
See other examples
Many Options may be used with build_include.
Setting up instance of build-include
import { BuildProcess } from "build-include/cjs/BuildProcess";
import { LoggerSimple } from "build-include/cjs/log/LoggerSimple";
// include LoggerSimple in the constructor so instance logs to the console.
const bp = new BuildProcess(new LoggerSimple());
const opt = {
match: {
kind: "buildIncludeSlash"
},
comment: {
type: "Single"
}
};
const results = bp.buildInclude('','./includes/replace.txt', opt);
import { BuildProcess } from "build-include/esm/BuildProcess";
import { LoggerSimple } from "build-include/esm/log/LoggerSimple";
// include LoggerSimple in the constructor so instance logs to the console.
const bp = new BuildProcess(new LoggerSimple());
const opt = {
match: {
kind: "buildIncludeSlash"
}
comment: {
type: "Single"
}
};
const results = bp.buildInclude('','./includes/replace.txt', opt);
See: Comment Type Single for full example.
Generated using TypeDoc