New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

breezeblock

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

breezeblock - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

39

index.js

@@ -35,5 +35,42 @@ exports.nodes = require('./lib/nodes');

*/
exports.asHTMLGenerator = function asHTMLGenerator(parsed, scope) {
exports.asHTML = function asHTML(parsed, scope) {
var ctx = new InterpreterContext(scope);
return parsed.asHTML(ctx);
};
/**
* Parses and compiles the template at the provided path
* @param {string} path Path to the file
* @return {*}
*/
exports.compileTemplate = function compileTemplate(path) {
var source = require('fs').readFileSync(path).toString();
var parsed = exports.parse(source);
return exports.asHTMLGenerator(parsed);
};
/**
* Parses and renders the template at the provided path
* @param {string} path Path to the file
* @param {object} options
* @param {Function} cb Callback
* @return {void}
*/
exports.renderTemplate = function renderTemplate(path, options, cb) {
require('fs').readFile(path, function(err, buf) {
if (err) {
cb(err, null);
return;
}
var source = buf.toString();
var parsed = exports.parse(source);
try {
cb(null, exports.asHTML(parsed, options));
} catch (e) {
cb(e, null);
}
});
};

2

package.json
{
"name": "breezeblock",
"version": "0.2.0",
"version": "0.2.1",
"description": "A flexible JS-based templating engine",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -7,3 +7,22 @@ # BreezeBlock

```bash
npm install breezeblock --save
```
Using Breezeblock in Express:
```js
var express = require('express');
var app = express();
app.engine('brz', require('breezeblock').renderFile);
app.set('view engine', 'brz');
app.get('/', function(req, res) {
// This will render myTemplate.brz
res.render('myTemplate', {foo: 'bar', my: 'variables'});
});
```
## Technique

@@ -10,0 +29,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc