Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
context-parser-handlebars
Advanced tools
Handlebars Pre-compiler with Context Parser. This npm package provides a handy command line utility to pre-process the Handlebars template by adding customized filters based on the context analysis of the HTML5 pages without affecting the exisiting framework of using Handlebars for their web applications.
Install the npm context-parser-handlebars from the npm repo.
npm install context-parser-handlebars
Prepare a simple handlebars template file.
cat <handlebars template file>
<html><title>{{title}}</title></html>
Run the handlebars template file with our Handlebars Pre-compiler and context filter is added.
./bin/handlebarspc <handlebars template file>
<html><title>{{{yd title}}}</title></html>
The new pre-compiled template file is compatible with vanilla Handlebars and those can be used in the vanilla Handlebars with our new secure-handlebars-helpers in the client side!
Note: the default 'h' filter in Handlebars is disabled with raw {{{expression}}}.
Analyze the execution context of HTML 5 web page in server side.
/* create the context parser */
var ContextParserHandlebars = require("context-parser-handlebars");
var parser = new ContextParserHandlebars();
/* read the html web page */
var data = '<html><title>{{title}}</title></html>';
/* analyze the execution context */
try {
parser.contextualize(data);
/* the output is the new handlebars template file with context filter added!
var output = '<html><title>{{{yd title}}}</title></html>';
*/
var output = parser.getBuffer().join('');
} catch (err) {
...
}
...
npm test
This software is free to use under the BSD license. See the LICENSE file for license text and copyright information.
FAQs
Handlebars Context PreCompiler
The npm package context-parser-handlebars receives a total of 1 weekly downloads. As such, context-parser-handlebars popularity was classified as not popular.
We found that context-parser-handlebars demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers 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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.