Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
multiplex-templates
Advanced tools
Embed components in other components!
npm install --save multiplex-templates
var multiplex = require('multiplex-templates')();
multiplex.render('path/to/template.ext', data);
This will render a template. The templating engine it uses is determined by the template's extension.
e.g.
components/paragraph/template.jade
templates/header.nunjucks
We support all of the engines that consolidate.js supports.
This module exposes the instances of the templating engines, so you can add mixins/filters/globals/etc onto them:
var env = multiplex.engines.nunjucks;
env.addGlobal('key', 'value');
You can also instantiate your own engines (and configure them however you like) and pass them into multiplex-templates.
var env = require('nunjucks').configure('.', { watch: false }),
jadeEnv = require('jade'), // so cool, doesn't need config (⌐■_■)
multiplex = require('multiplex-templates')({
nunjucks: env,
jade: jadeEnv
});
// multiplex.engines.nunjucks === env
To embed a template, call the embed
function in the parent template, passing in the name of the template you want to embed, plus (optionally) data and defaults objects. The embed
function is available in all templating languages that allow functions inside template locals.
Nunjucks:
{{ embed('path/to/tpl.nunjucks', data) | safe }}
Jade:
section#foo
p.embedded
!= embed('path/to/tpl.jade', data)
The data
you pass in is then used to render the child template. You can optionally pass in additional data:
Nunjucks:
{{ embed('path/to/tpl.mustache', data, defaults) | safe }}
Jade:
section#foo
p.embedded
!= embed('path/to/tpl.ejs', data, defaults)
Properties in the data
object will overwrite properties of the same name in the defaults
object, as this uses lodash's fast _.defaults()
method.
npm test
FAQs
Easy embedding for multiple template languages
The npm package multiplex-templates receives a total of 47 weekly downloads. As such, multiplex-templates popularity was classified as not popular.
We found that multiplex-templates demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 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
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.