Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix regression with `wrapped`

Closes gh-39
  • Loading branch information...
commit 8b86dc030be9049224572a64a61c6c6b0744c8e0 1 parent 8a4bd79
@tkellen tkellen authored
View
4 CHANGELOG
@@ -1,3 +1,7 @@
+v0.5.7:
+ date: 2013-03-11
+ changes:
+ - Fix regression with 'wrapped' option.
v0.5.6:
date: 2013-03-07
changes:
View
6 Gruntfile.js
@@ -47,13 +47,13 @@ module.exports = function(grunt) {
'tmp/handlebars-node.js': ['test/fixtures/_partial.hbs', 'test/fixtures/one.hbs']
}
},
- wrapcompile: {
+ nowrap: {
options: {
namespace: 'JST',
- wrapped: true
+ wrapped: false
},
files: {
- 'tmp/handlebarswrap.js': ['test/fixtures/_partial.hbs', 'test/fixtures/one.hbs']
+ 'tmp/handlebarsnowrap.js': ['test/fixtures/_partial.hbs', 'test/fixtures/one.hbs']
}
},
uglyfile: {
View
3  README.md
@@ -188,6 +188,7 @@ handlebars: {
## Release History
+ * 2013-03-10   v0.5.7   Fix regression with 'wrapped' option.
* 2013-03-06   v0.5.6   [object Object]
* 2013-02-26   v0.5.5   Add new options partialsUseNamespace, partialRegex, partialsPathRegex
* 2013-02-14   v0.5.4   First official release for Grunt 0.4.0.
@@ -209,4 +210,4 @@ handlebars: {
Task submitted by [Tim Branyen](http://tbranyen.com)
-*This file was generated on Thu Mar 07 2013 07:57:54.*
+*This file was generated on Mon Mar 11 2013 09:51:45.*
View
2  package.json
@@ -1,7 +1,7 @@
{
"name": "grunt-contrib-handlebars",
"description": "Precompile Handlebars templates to JST file.",
- "version": "0.5.6",
+ "version": "0.5.7",
"homepage": "https://github.com/gruntjs/grunt-contrib-handlebars",
"author": {
"name": "Grunt Team",
View
7 tasks/handlebars.js
@@ -81,12 +81,11 @@ module.exports = function(grunt) {
compiled = Handlebars.precompile(ast);
// if configured to, wrap template in Handlebars.template call
- if (options.wrapped) {
+ if (options.wrapped === true) {
compiled = 'Handlebars.template('+compiled+')';
}
- // if configured for amd and the namespace has been explicitly set
- // to false, the handlebars template will be directly returned
- if (options.wrapped && options.amd && options.namespace === false) {
+
+ if(options.amd && options.namespace === false) {
compiled = 'return ' + compiled;
}
} catch (e) {
View
8 test/expected/handlebarswrap.js → test/expected/handlebarsnowrap.js
@@ -1,15 +1,15 @@
this["JST"] = this["JST"] || {};
-Handlebars.registerPartial("partial", Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
+Handlebars.registerPartial("partial", function (Handlebars,depth0,helpers,partials,data) {
this.compilerInfo = [2,'>= 1.0.0-rc.3'];
helpers = helpers || Handlebars.helpers; data = data || {};
return "<span>Canada</span>";
- }));
+ });
-this["JST"]["test/fixtures/one.hbs"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
+this["JST"]["test/fixtures/one.hbs"] = function (Handlebars,depth0,helpers,partials,data) {
this.compilerInfo = [2,'>= 1.0.0-rc.3'];
helpers = helpers || Handlebars.helpers; partials = partials || Handlebars.partials; data = data || {};
var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
@@ -24,4 +24,4 @@ helpers = helpers || Handlebars.helpers; partials = partials || Handlebars.parti
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "</p>";
return buffer;
- });
+ };
View
6 test/handlebars_test.js
@@ -21,12 +21,12 @@ exports.handlebars = {
test.done();
},
- wrapcompile: function(test) {
+ nowrap: function(test) {
'use strict';
test.expect(1);
- var actual = grunt.file.read('tmp/handlebarswrap.js');
- var expected = grunt.file.read('test/expected/handlebarswrap.js');
+ var actual = grunt.file.read('tmp/handlebarsnowrap.js');
+ var expected = grunt.file.read('test/expected/handlebarsnowrap.js');
test.equal(actual, expected, 'should compile partials into Handlebars.partials and handlebars template into JST');
test.done();
Please sign in to comment.
Something went wrong with that request. Please try again.