handlebars-layouts
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -37,3 +37,2 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.handlebarsLayouts = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
function applyAction(val, action) { | ||
// jshint validthis:true | ||
switch (action.mode) { | ||
@@ -90,2 +89,3 @@ case 'append': { | ||
* @param {String} name | ||
* @param {?Object} customContext | ||
* @param {Object} options | ||
@@ -96,3 +96,9 @@ * @param {Function(Object)} options.fn | ||
*/ | ||
extend: function (name, options) { | ||
extend: function (name, customContext, options) { | ||
// Make `customContext` optional | ||
if (arguments.length < 3) { | ||
options = customContext; | ||
customContext = null; | ||
} | ||
options = options || {}; | ||
@@ -104,4 +110,4 @@ | ||
// Mix attributes into context | ||
mixin(context, options.hash); | ||
// Mix custom context and hash into context | ||
mixin(context, customContext, options.hash); | ||
@@ -128,2 +134,3 @@ // Partial template required | ||
* @param {String} name | ||
* @param {?Object} customContext | ||
* @param {Object} options | ||
@@ -130,0 +137,0 @@ * @param {Function(Object)} options.fn |
@@ -15,10 +15,8 @@ 'use strict'; | ||
gulp.task('lint', function () { | ||
var jscs = require('gulp-jscs'), | ||
jshint = require('gulp-jshint'); | ||
var eslint = require('gulp-eslint'); | ||
return gulp | ||
.src([paths.gulp, paths.src, paths.test]) | ||
.pipe(jscs()) | ||
.pipe(jshint()) | ||
.pipe(jshint.reporter('jshint-stylish')); | ||
.pipe(eslint()) | ||
.pipe(eslint.format()); | ||
}); | ||
@@ -25,0 +23,0 @@ |
15
index.js
@@ -36,3 +36,2 @@ 'use strict'; | ||
function applyAction(val, action) { | ||
// jshint validthis:true | ||
switch (action.mode) { | ||
@@ -89,2 +88,3 @@ case 'append': { | ||
* @param {String} name | ||
* @param {?Object} customContext | ||
* @param {Object} options | ||
@@ -95,3 +95,9 @@ * @param {Function(Object)} options.fn | ||
*/ | ||
extend: function (name, options) { | ||
extend: function (name, customContext, options) { | ||
// Make `customContext` optional | ||
if (arguments.length < 3) { | ||
options = customContext; | ||
customContext = null; | ||
} | ||
options = options || {}; | ||
@@ -103,4 +109,4 @@ | ||
// Mix attributes into context | ||
mixin(context, options.hash); | ||
// Mix custom context and hash into context | ||
mixin(context, customContext, options.hash); | ||
@@ -127,2 +133,3 @@ // Partial template required | ||
* @param {String} name | ||
* @param {?Object} customContext | ||
* @param {Object} options | ||
@@ -129,0 +136,0 @@ * @param {Function(Object)} options.fn |
{ | ||
"name": "handlebars-layouts", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Handlebars helpers which implement layout blocks similar to Jade, Jinja, Swig, and Twig.", | ||
@@ -39,5 +39,4 @@ "keywords": [ | ||
"gulp": "^3.9.0", | ||
"gulp-eslint": "^0.14.0", | ||
"gulp-istanbul": "^0.10.0", | ||
"gulp-jscs": "^1.6.0", | ||
"gulp-jshint": "^1.11.0", | ||
"gulp-mocha": "^2.1.1", | ||
@@ -44,0 +43,0 @@ "gulp-prettify": "^0.3.0", |
@@ -0,1 +1,2 @@ | ||
/*eslint-env mocha */ | ||
'use strict'; | ||
@@ -7,2 +8,3 @@ | ||
fs = require('fs'), | ||
path = require('path'), | ||
through = require('through2'), | ||
@@ -12,6 +14,6 @@ vinylFs = require('vinyl-fs'), | ||
config = { | ||
partials: __dirname + '/fixtures/partials/', | ||
fixtures: __dirname + '/fixtures/templates/', | ||
expected: __dirname + '/expected/templates/', | ||
actual: __dirname + '/actual/templates/' | ||
partials: path.join(__dirname, '/fixtures/partials/'), | ||
fixtures: path.join(__dirname, '/fixtures/templates/'), | ||
expected: path.join(__dirname, '/expected/templates/'), | ||
actual: path.join(__dirname, '/actual/templates/') | ||
}; | ||
@@ -29,5 +31,6 @@ | ||
function compileFile(file, enc, cb) { | ||
// jshint validthis: true | ||
var template; | ||
try { | ||
var template = handlebars.compile(String(file.contents)); | ||
template = handlebars.compile(String(file.contents)); | ||
file.contents = new Buffer(template(data)); | ||
@@ -74,9 +77,9 @@ this.push(file); | ||
handlebars.registerPartial({ | ||
'deep-a': read(config.partials + '/deep-a.hbs'), | ||
'deep-b': read(config.partials + '/deep-b.hbs'), | ||
'deep-c': read(config.partials + '/deep-c.hbs'), | ||
layout: read(config.partials + '/layout.hbs'), | ||
'deep-a': read(config.partials + '/deep-a.hbs'), | ||
'deep-b': read(config.partials + '/deep-b.hbs'), | ||
'deep-c': read(config.partials + '/deep-c.hbs'), | ||
layout: read(config.partials + '/layout.hbs'), | ||
layout2col: read(config.partials + '/layout2col.hbs'), | ||
media: read(config.partials + '/media.hbs'), | ||
user: read(config.partials + '/user.hbs') | ||
media: read(config.partials + '/media.hbs'), | ||
user: read(config.partials + '/user.hbs') | ||
}); | ||
@@ -83,0 +86,0 @@ }); |
@@ -0,1 +1,2 @@ | ||
/*eslint-env mocha */ | ||
'use strict'; | ||
@@ -17,3 +18,3 @@ | ||
return (data && data.foo) || ''; | ||
return data && data.foo || ''; | ||
} | ||
@@ -20,0 +21,0 @@ }, |
Sorry, the diff of this file is not supported yet
72526
16
43
907