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.
More than a mustache.
npm install beard
const data = {
noun: 'beards',
capitalize: str => str.charAt(0).toUpperCase() + str.slice(1)
};
const Beard = require('beard');
const engine = new Beard({
templates: {
'/example': '{{capitalize(noun)}} are itchy.'
}
});
const result = engine.render('/example', data);
console.log(result); // returns 'Beards are itchy.'
opts (object) - An object literal with the following optional engine options:
'~'
in paths, E.g. '~/layout'
).false
to disable caching of template files. Defaults to true
.path (string) - A string to be parsed and populated by the view object.
locals (object) - An object of data and/or methods which will populate the template string.
const Beard = require('beard');
const engine = new Beard({
templates: {
'/layout': 'header | {{view}} | footer',
'/app/page/content': "{{extends '/layout'}}content {{include '~/component'}}",
'/app/component': 'and component'
},
root: '/',
home: 'app/',
cache: true
});
const result = engine.render('/app/page/content');
console.log(result); // returns 'header | content and component | footer'
Includes a template, can optionally pass locals.
{{include 'template'}}
{{include('template', {arg: 'val', arg2: 'val2'})}}
Extends template with a layout. Template will be accessible as "view" variable.
layout.brd.html
<html>
<body>
{{view}}
</body>
</html>
and rendering:
{{extends 'layout'}}view content
Returns:
<html>
<body>
view content
</body>
</html>
Makes content available as variable name.
{{block middle}}
Middle
{{endblock}}
Top
{{middle}}
Bottom
Returns:
Top
Middle
Bottom
{{if x === 1}}
x is 1
{{else if x > 1}}
x is greater than 1
{{else}}
x is less than 1
{{end}}
Iterate over properties in object.
{{for key, value in object}}
{{key}} = {{value}}
{{end}}
Iterate over array.
{{each item in array}}
{{item.property}}
{{end}}
Released under MIT license.
FAQs
More than a mustache.
The npm package beard receives a total of 41 weekly downloads. As such, beard popularity was classified as not popular.
We found that beard 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
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.