
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
consolidate-jstransformer
Advanced tools
Consolidate-compatible API to use JSTransformers.
Replace the consolidate
package with consolidate-jstransformer
.
var cons = require('consolidate')
var cons = require('consolidate-jstransformer')
Use consolidate-jstransformer
the same way you would use Consolidate:
var cons = require('consolidate-jstransformer');
cons.swig('views/page.html', { user: 'tobi' }, function(err, html){
if (err) throw err;
console.log(html);
});
Or without options / local variables:
var cons = require('consolidate-jstransformer');
cons.swig('views/page.html', function(err, html){
if (err) throw err;
console.log(html);
});
To dynamically pass the engine, simply use the subscript operator and a variable:
var cons = require('consolidate-jstransformer')
, name = 'swig';
cons[name]('views/page.html', { user: 'tobi' }, function(err, html){
if (err) throw err;
console.log(html);
});
Render strings rather than files:
var cons = require('consolidate-jstransformer')
, name = 'swig';
cons[name].render('Hello {{ user }}', { user: 'tobi' }, function(err, html){
if (err) throw err;
console.log(html);
});
If no callback function is provided, a Promise will be returned.
var cons = require('consolidate-jstransformer');
cons.swig('views/page.html', { user: 'tobi' })
.then(function (html) {
console.log(html);
})
.catch(function (err) {
throw err;
});
MIT
v1.0.0: 2018-02-15
FAQs
Consolidate-compatible API to use JSTransformers.
The npm package consolidate-jstransformer receives a total of 1 weekly downloads. As such, consolidate-jstransformer popularity was classified as not popular.
We found that consolidate-jstransformer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.