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.
concoct
Advanced tools
Readme
A content compiler on Node.js
ConcoctJS knows how to compile templates with some context and write the results to disk. Anything in the middle is up to plugins.
ConcoctJS works with any templating engine, as long as there is a plugin to handle it. The contexts with which templates are compiled are simply JSON files; and they too can be modified by plugins. In fact, JSON files are not really needed, as contexts can be generated just by plugins.
Contexts are linked to templates using one of the following:
ConcoctJS' workflow is simple:
If no plugin is present to actually compile the templates, then all the buffers are just copies of the uncompiled templates.
The ConcoctJS module exports a constructor which receives an options
object with the following fields:
The constructed object has only one public method - concoct()
.
templates
Type: String / Array
Required: yes
Tells Concoct where to find templates. Can be specified as a glob pattern string, or an array of such strings.
{
templates: [
"article_templates/*.tpl",
"static_templates/*.tpl",
"other_templates/**/*.tpl"
]
}
contexts
Type: String / Array
Required: yes
Tells Concoct where to find contexts.
Works the same as the templates
field (see above).
plugins
Type: Array
Required: no
An array of 'plugin' objects. See the section 'Plugins' below.
Type: Object
Required: no
A collection of key:value pairs, which are used to associate contexts with templates. both 'key' and 'value' can be path glob pattens.
Linking rules are defined with a glob pattern matching dictionary. So from x
templates and y
contexts you can compile (at most) x * y
files.
{
"contexts/*.json": "templates/*.tpl"
}
{
"contexts/*.json": "templates/article.tpl"
}
dest
Type: String
Required: no
Destination directory to write the buffers.
concoct()
The concoct
method starts the concoction process.
A 'plugin' object contains the information needed by Concoct to run the plugin. It needs to have to following fields (all are optional)
name
Type: String
The name of the plugin as to be identified in Concoct's log messages.
handler
Type: Function
Arguments: params, templates, contexts, links, buffers, done
The function Concoct calls when running the plugin.
params
Type: Object
An object to be passed to the plugin's handler function.
npm install concoct
var Concoction = require('concoct'),
options = {
plugins: [ /* list of plugins */ ],
templates: [ /* paths to templates */ ],
contexts: [ /* paths to contexts */ ],
linkingRules: {
/* key: value */
},
dest: /* destination path */
},
c = new Concoction(options);
c.concoct(function(err) {
/* Done. Check err. */
});
ConcoctJS provides logs on four levels: info
, error
, warn
and debug
.
Logging is enabled/disabled with the environment variable DEBUG
.
To enable logging on all levels set DEBUG=concoct:*
.
To enable logging on all levels except debug
set DEBUG="concoct:* -concoct:debug"
.
FAQs
A content compiler on Node.js. ConcoctJS knows how to compile templates with some context and write the results to disk. Anything in the middle is up to plugins. ConcoctJS works with any templating engine, as long as there is a plugin to handle it. The co
The npm package concoct receives a total of 10 weekly downloads. As such, concoct popularity was classified as not popular.
We found that concoct 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.