Comparing version 2.1.0 to 2.2.0
@@ -50,3 +50,3 @@ /*jshint node: true*/ | ||
if (opts.c || opts.compiler) { | ||
compiler = opts.c || opts.compiler; | ||
compiler = opts.c || opts.compiler; | ||
} | ||
@@ -63,3 +63,3 @@ } | ||
function() { | ||
var js = precompiler.precompile(buffer); | ||
var js = precompiler.precompile(buffer, opts && opts.precompilerOptions); | ||
// Compile only with the runtime dependency. | ||
@@ -66,0 +66,0 @@ var compiled = "// hbsfy compiled Handlebars template\n"; |
{ | ||
"name": "hbsfy", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Handlebars precompiler plugin for Browserify v2", | ||
@@ -16,3 +16,2 @@ "main": "index.js", | ||
"browserify", | ||
"v2", | ||
"js", | ||
@@ -19,0 +18,0 @@ "plugin", |
@@ -60,6 +60,47 @@ [![Build Status](https://travis-ci.org/epeli/node-hbsfy.png?branch=master)](https://travis-ci.org/epeli/node-hbsfy) | ||
Options for the precompiler can be passed using a `precompilerOptions` key. | ||
Example: | ||
Enable `myUltimateHelper` only | ||
browserify --precompilerOptions [ --knownHelpersOnly --knownHelpers [ --myUltimateHelper ] ] main.js > bundle.js | ||
See [Handlebars API reference](http://handlebarsjs.com/reference.html) for | ||
details. | ||
## package.json | ||
Transform can be configured from the package.json too. | ||
```json | ||
{ | ||
"browserify": { | ||
"transform": [ | ||
["hbsfy", { | ||
"extensions": ["html"] | ||
"precompilerOptions": { | ||
"knownHelpersOnly": true, | ||
"knownHelpers": { | ||
"myUltimateHelper": true | ||
} | ||
} | ||
} | ||
] | ||
] | ||
} | ||
} | ||
``` | ||
The `precompiler` and `compiler` keys are naturally available too. | ||
See [module-deps | ||
documentation](https://github.com/substack/module-deps#packagejson-transformkey) | ||
for more information as this feature is implemented there (it's a part of | ||
Browserify itself). | ||
## Programmatic usage | ||
When compiling using Javascript code custom extensions | ||
can be set: | ||
The `configure` method of the transform can be used to create new transforms | ||
with different defaults. | ||
@@ -103,5 +144,9 @@ ```javascript | ||
### 2.2.0 | ||
- Support for compiler options [#29](https://github.com/epeli/node-hbsfy/pull/29) | ||
### 2.1.0 | ||
- Subargs options for alternate precompilers and compilers [31](https://github.com/epeli/node-hbsfy/pull/31) | ||
- Subargs options for alternate precompilers and compilers [#31](https://github.com/epeli/node-hbsfy/pull/31) | ||
@@ -108,0 +153,0 @@ ### 2.0.0 |
28995
27
590
179
10