
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
smart-template-injector
Advanced tools
You can process an template injecting stretches of anything with an context object.
You can process an template injecting stretches of anything with an context object.
npm install smart-template-injector
You can use basically on pattern to select inject tag:
/*inject:*/
After of :
you can put the property name of the object what you want to use.
var smartTemplateInjector = require('smart-template-injector');
var template = ""
+ "/*inject:libs*/\n"
+ "\n"
+ "var smartSomeFunction = {\n"
+ " someFunction: SomeFunction\n"
+ "};\n"
+ "\n"
+ "module.exports = smartSomeFunction;\n"
+ "\n"
+ "function SomeFunction() {\n"
+ " console.log('All right.');\n"
+ "};\n"
+ "\n"
+ "/*inject:function*/\n";
var obj = {
libs: "var path = path || require('path');\nvar fs = fs || require('fs');",
function: "function AnotherFunction() {\n console.log('All ok.');\n};"
};
console.log(smartTemplateInjector.inject(template, obj));
var smartTemplateInjector = require('smart-template-injector');
var template = ""
+ "/*inject:module.libs*/\n"
+ "\n"
+ "var smartSomeFunction = {\n"
+ " someFunction: SomeFunction\n"
+ "};\n"
+ "\n"
+ "module.exports = smartSomeFunction;\n"
+ "\n"
+ "function SomeFunction() {\n"
+ " console.log('All right.');\n"
+ "};\n"
+ "\n"
+ "/*inject:module.function*/\n";
var obj = {
module: {
libs: "var path = path || require('path');\nvar fs = fs || require('fs');",
function: "function AnotherFunction() {\n console.log('All ok.');\n};"
}
};
console.log(smartTemplateInjector.inject(template, obj));
0.0.1 Project start. 0.0.2 Fix inject function to respect line breaks.
Danke
FAQs
You can process an template injecting stretches of anything with an context object.
We found that smart-template-injector demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.