Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
component-render
Advanced tools
Readme
Render html file from template file for component
With Component previously installed:
$ npm install -g component-render
Usage: component-render [options] <template>
Options:
-V, --version
-h, --help output usage information
-l, --local <json> local <json> file
-o, --out <path> output html file <path>
-u, --use <name> use the given render <name> plugin
# redner html file from template file
$ component render simple.jade
# render html file from template file with local json file
$ component render -l user.json user.jade
# render html file to output path
$ component render -o ./static/html/simple.html simple.jade
# render html file with plugin
$ component render -u component-render-hogan -l user.json user.mustache
Use Jade
template engine. Hogan
, EJS
, and other template engine, you can support with plugin.
You need to implement below function.
template
, program
and fn
arugments.template
: a template file path.program
: commander
object.fn
: a callback function. specify error
, html
to arguments.
var hogan = require('hogan.js');
var path = require('path');
var fs = require('fs');
module.exports = function (template, program, fn) {
var local = {};
if (program.local) {
var resolve_path = path.resolve(program.local);
local = fs.existsSync(resolve_path) ? require(resolve_path) : require(resolve_path + '.json');
}
fs.readFile(template, { encoding: 'utf8' }, function (err, data) {
if (err) { return fn(err); }
var renderer = hogan.compile(data);
var html = renderer.render(local);
fn(null, html);
});
};
See the LICENSE
.
FAQs
Render html files from template files for component
The npm package component-render receives a total of 0 weekly downloads. As such, component-render popularity was classified as not popular.
We found that component-render 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.