inprint
A very simple precompiler (written in typescript). With it you can make a dynamically generated blocks in your code.
Installation
npm i inprint --save-dev
yarn i inprint --save-dev
pnpm i inprint --save-dev
npm i -g inprint
yarn i -g inprint
pnpm i -g inprint
Usage
Anywhere in your code add a block you want to generate like this
console.log("any code can be here");
console.log("any code can be here");
Now add inprint.cjs (or .js) to your project with the following contents:
module.exports.inprint = {
files:['src/**/*.{ts,tsx,js,jsx}'],
inprint: function inprint(paramsObject) {
return " // " + JSON.stringify(paramsObject);
}
}
The returned content will be inprinted between @INPRINT tags.
inprint function will receive the following additional paramaters:
Options:
-
inprint - required, the function used to generate inprinted content
-
files - optional, globby input patterns, default is ['src/**/*.{ts,tsx,js,jsx}']
-
skipNodeModules- optional, if true will skip all path containing /node_modules/, default is true