grunt-contrib-handlebars
Advanced tools
Comparing version
{ | ||
"name": "grunt-contrib-handlebars", | ||
"description": "Precompile Handlebars templates to JST file.", | ||
"version": "0.11.0", | ||
"version": "1.0.0", | ||
"author": { | ||
@@ -14,2 +14,3 @@ "name": "Grunt Team", | ||
}, | ||
"main": "tasks/handlebars.js", | ||
"scripts": { | ||
@@ -32,5 +33,2 @@ "test": "grunt test" | ||
}, | ||
"peerDependencies": { | ||
"grunt": ">=0.4.0" | ||
}, | ||
"keywords": [ | ||
@@ -37,0 +35,0 @@ "gruntplugin" |
@@ -1,2 +0,2 @@ | ||
# grunt-contrib-handlebars v0.11.0 [](https://travis-ci.org/gruntjs/grunt-contrib-handlebars) [](https://ci.appveyor.com/project/gruntjs/grunt-contrib-handlebars/branch/master) | ||
# grunt-contrib-handlebars v1.0.0 [](https://travis-ci.org/gruntjs/grunt-contrib-handlebars) [](https://ci.appveyor.com/project/gruntjs/grunt-contrib-handlebars/branch/master) | ||
@@ -8,3 +8,2 @@ > Precompile Handlebars templates to JST file. | ||
## Getting Started | ||
This plugin requires Grunt `>=0.4.0` | ||
@@ -34,3 +33,3 @@ If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: | ||
#### separator | ||
Type: `String` | ||
Type: `String` | ||
Default: `linefeed + linefeed` | ||
@@ -41,3 +40,3 @@ | ||
#### namespace | ||
Type: `String` or `false` or `function` | ||
Type: `String` or `false` or `function` | ||
Default: `'JST'` | ||
@@ -48,3 +47,3 @@ | ||
Example: | ||
```javascript | ||
```js | ||
options: { | ||
@@ -58,3 +57,3 @@ namespace: 'MyApp.Templates' | ||
Example: | ||
```javascript | ||
```js | ||
options: { | ||
@@ -65,5 +64,5 @@ namespace: function(filename) { | ||
}, | ||
files: { | ||
'ns_nested_tmpls.js' : [ 'modules/**/*.hbs'] | ||
} | ||
}, | ||
files: { | ||
'ns_nested_tmpls.js' : [ 'modules/**/*.hbs'] | ||
} | ||
@@ -73,3 +72,3 @@ ``` | ||
#### partialsUseNamespace | ||
Type: `Boolean` | ||
Type: `Boolean` | ||
Default: `false` | ||
@@ -80,3 +79,3 @@ | ||
#### wrapped | ||
Type: `Boolean` | ||
Type: `Boolean` | ||
Default: `true` | ||
@@ -87,3 +86,3 @@ | ||
#### node | ||
Type: `Boolean` | ||
Type: `Boolean` | ||
Default: `false` | ||
@@ -96,3 +95,3 @@ | ||
#### amd | ||
Type: `Boolean` or `String` or `Array` or `Function` | ||
Type: `Boolean` or `String` or `Array` or `Function` | ||
Default: `false` | ||
@@ -104,7 +103,7 @@ | ||
If `Array` then those strings will be used in the module definition. `'handlebars'` should always be the first item in the array, eg: `amd: ['handlebars', 'handlebars.helpers']` | ||
If `Array` then those strings will be used in the module definition. `'handlebars'` should always be the first item in the array, eg: `amd: ['handlebars', 'handlebars.helpers']` | ||
If `Function` then it will be called per each module and returned string will be used in the module defintion `"define(['" + options.amd(filename, ast, compiled) + "']"` | ||
```javascript | ||
```js | ||
define(['handlebars'], function(Handlebars) { | ||
@@ -117,3 +116,3 @@ //...// | ||
#### commonjs | ||
Type: `Boolean` | ||
Type: `Boolean` | ||
Default: `false` | ||
@@ -123,3 +122,3 @@ | ||
```javascript | ||
```js | ||
module.exports = function(Handlebars) { | ||
@@ -134,3 +133,3 @@ //...// | ||
```javascript | ||
```js | ||
var Handlebars = require('handlebars'); | ||
@@ -141,7 +140,7 @@ var templates = require('./templates')(Handlebars); | ||
#### processContent | ||
Type: `function` | ||
Type: `Function` | ||
This option accepts a function which takes two arguments (the template file content, and the filepath) 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. | ||
```javascript | ||
```js | ||
options: { | ||
@@ -157,7 +156,7 @@ processContent: function(content, filepath) { | ||
#### processAST | ||
Type: `function` | ||
Type: `Function` | ||
This option accepts a function which takes one argument (the parsed Abstract Syntax Tree) and returns a modified version which will be used as the source for the precompiled template object. The example below removes any partial and replaces it with the text `foo`. | ||
```javascript | ||
```js | ||
options: { | ||
@@ -176,7 +175,7 @@ processAST: function(ast) { | ||
#### processName | ||
Type: `function` | ||
Type: `Function` | ||
This option accepts a function which takes one argument (the template filepath) and returns a string which will be used as the key for the precompiled template object. The example below stores all templates on the default JST namespace in capital letters. | ||
```javascript | ||
```js | ||
options: { | ||
@@ -190,11 +189,11 @@ processName: function(filePath) { | ||
#### processPartialName | ||
Type: `function` | ||
Type: `Function` | ||
This option accepts a function which takes one argument (the partial filepath) and returns a string which will be used as the key for the precompiled partial object when it is registered in Handlebars.partials. The example below stores all partials using only the actual filename instead of the full path. | ||
```javascript | ||
```js | ||
options: { | ||
processPartialName: function(filePath) { // input: templates/_header.hbs | ||
processPartialName: function(filePath) { // input: templates/_header.hbs | ||
var pieces = filePath.split("/"); | ||
return pieces[pieces.length - 1]; // output: _header.hbs | ||
return pieces[pieces.length - 1]; // output: _header.hbs | ||
} | ||
@@ -207,3 +206,3 @@ } | ||
#### partialRegex | ||
Type: `Regexp` | ||
Type: `Regexp` | ||
Default: `/^_/` | ||
@@ -213,3 +212,3 @@ | ||
```javascript | ||
```js | ||
// assumes partial files would be prefixed with "par_" ie: "par_header.hbs" | ||
@@ -222,3 +221,3 @@ options: { | ||
#### partialsPathRegex | ||
Type: `Regexp` | ||
Type: `Regexp` | ||
Default: `/./` | ||
@@ -228,3 +227,3 @@ | ||
```javascript | ||
```js | ||
options: { | ||
@@ -237,3 +236,3 @@ partialRegex: /.*/, | ||
#### compilerOptions | ||
Type `Object` | ||
Type `Object` | ||
Default: `{}` | ||
@@ -243,3 +242,3 @@ | ||
```javascript | ||
```js | ||
options: { | ||
@@ -258,3 +257,3 @@ compilerOptions: { | ||
```javascript | ||
```js | ||
handlebars: { | ||
@@ -276,2 +275,3 @@ compile: { | ||
* 2016-03-04 v1.0.0 Update docs and examples. Remove peerDeps and other fixes. | ||
* 2015-10-16 v0.11.0 Handlebars ~4 | ||
@@ -316,2 +316,2 @@ * 2015-04-21 v0.10.2 Added options.amd as a function | ||
*This file was generated on Fri Oct 16 2015 11:17:16.* | ||
*This file was generated on Fri Mar 04 2016 17:22:00.* |
@@ -5,3 +5,3 @@ /* | ||
* | ||
* Copyright (c) 2015 Tim Branyen, contributors | ||
* Copyright (c) 2016 Tim Branyen, contributors | ||
* Licensed under the MIT license. | ||
@@ -8,0 +8,0 @@ */ |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
24240
0.26%3
-25%1
-50%