Options
All
  • Public
  • Public/Protected
  • All
Menu

BUILD_INCLUDE

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.

Simple example

main.js includes in it contents the following line

// BUILD_INCLUDE(./includes/replaceComment.txt)

Build-Include Replace

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

Options

Many Options may be used with build_include.

Setting up instance of build-include

Simple Setup

Common JS

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);

ES6 Module

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.

See Also

Generated using TypeDoc