Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hbsfy

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hbsfy - npm Package Compare versions

Comparing version 2.5.1 to 2.6.0

test/indentation_test.js

13

index.js

@@ -14,2 +14,5 @@ /*jshint node: true*/

};
var defaultProcessContent = function(content) {
return content;
}

@@ -74,2 +77,3 @@ var MARKER = "// hbsfy compiled Handlebars template\n";

var traverse = defaultTraverse;
var processContent = defaultProcessContent;

@@ -94,2 +98,6 @@ opts = opts || {};

}
if (opts.pc || opts.processContent) {
processContent = opts.pc || opts.processContent;
}
}

@@ -101,3 +109,4 @@

compiler: compiler,
traverse: traverse
traverse: traverse,
processContent: processContent
});

@@ -111,2 +120,3 @@ }

var traverse = options.traverse;
var processContent = options.processContent;

@@ -120,2 +130,3 @@ var js;

file = file.replace(/^\uFEFF/, '');
file = processContent(file);

@@ -122,0 +133,0 @@ if (traverse) {

2

package.json
{
"name": "hbsfy",
"version": "2.5.1",
"version": "2.6.0",
"description": "Handlebars precompiler plugin for Browserify v2",

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

@@ -201,5 +201,22 @@ [![Build Status](https://travis-ci.org/epeli/node-hbsfy.png?branch=master)](https://travis-ci.org/epeli/node-hbsfy)

### Process output HTML string
This option accepts a function which takes one argument (the template file content) and returns a string which will be used as the source for the precompiled template object. The example below removes leading and trailing spaces to shorten templates.
```
hbsfy.configure({
processContent: function(content) {
content = content.replace(/^[\x20\t]+/mg, '').replace(/[\x20\t]+$/mg, '');
content = content.replace(/^[\r\n]+/, '').replace(/[\r\n]*$/, '\n');
return content;
}
});
```
## Changelog
### 2.6.0
- Add `processContent` option. [#50](https://github.com/epeli/node-hbsfy/pull/50)
### 2.5.0

@@ -206,0 +223,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