![Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack](https://cdn.sanity.io/images/cgdhsj6q/production/6af25114feaaac7179b18127c83327568ff592d1-1024x1024.webp?w=800&fit=max&auto=format)
Security News
Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
@buxlabs/html-engine
Advanced tools
Readme
Compile HTML templates into JS
HTML Engine is a library designed to compile HTML templates into JS. It analyses the template and generates an optimal rendering function that can be used on the client and the server. The compilation process should ideally happen in a build step (for the client) or the output could be memoized after first usage (for the server).
The syntax of the template should be easy to read and write. There are two types of tags: curly and html tags.
{name}
is a curly tag
Curly tags can contain expressions, e.g. {1 + 2}
is a valid tag.
They can also contain additional modifiers like {name | capitalize}
<if>
is an html tag
HTML tags can contain additional attributes, e.g. <if limit is a number>
is a valid tag. The attribute syntax follows the natural language principles.
npm install @buxlabs/html-engine
const { compile } = require('@buxlabs/html-engine')
const template = compile('<div>{foo}</div>')
assert(template({ foo: 'bar' }) === '<div>bar</div>')
<if foo is present>{bar}</if>
function render(__o, __e) {
var __t = "";
if (__o.foo !== void 0) {
__t += __e(__o.bar);
}
return __t;
}
<for month in months>{month}</for>
function render(__o, __e) {
var __t = "";
for (var a = 0, b = __o.months.length; a < b; a += 1) {
var month = __o.months[a];
__t += __e(month);
}
return __t;
}
<foreach month in months>{month}</foreach>
function render(__o, __e) {
var __t = "";
__o.months.forEach(function (month) {
__t += __e(month);
});
return __t;
}
npm run benchmark
html-engine x 3,372,492 ops/sec ±1.66% (91 runs sampled)
underscore x 175,306 ops/sec ±0.68% (96 runs sampled)
lodash x 208,329 ops/sec ±0.44% (91 runs sampled)
mustache x 460,274 ops/sec ±1.07% (77 runs sampled)
Fastest is html-engine
MIT
FAQs
Compile HTML templates into JS
The npm package @buxlabs/html-engine receives a total of 5 weekly downloads. As such, @buxlabs/html-engine popularity was classified as not popular.
We found that @buxlabs/html-engine demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.