Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork276
Open
Description
Version: 0.24.3
Error:
Nested if statements cause custom parameters in partials to become global in scope, which causes subsequent uses of that partial to hold onto those parameter values unless they are declared as empty strings or new values. Using gulp.
gulpfile.js
vargulp=require('gulp');varextname=require('gulp-extname');varassemble=require('assemble');varapp=assemble();gulp.task('load',function(cb){app.partials('templates/partials/**/*.hbs');app.layouts('templates/layouts/*.hbs');app.pages('templates/pages/*.hbs');cb();});gulp.task('assemble',['load'],function(){returnapp.toStream('pages').pipe(app.renderFile()).pipe(extname()).pipe(app.dest('site'));});gulp.task('default',['assemble']);
p.hbs partial
{{#if copy}}{{#if test}}{{test}}{{/if}}<p>{{{copy}}}</p>{{/if}}index.hbs page file
---layout: default.hbssubject: Branded transaction email example---{{> p copy="copy1" test="abc" }}{{> p copy="copy2" }}{{> p copy="copy3" }}{{> p copy="copy4" }}layout.hbs layout file
<!doctype html><html><head><meta name="viewport" content="width=device-width" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title></title><link href="../src/css/main.css" media="all" rel="stylesheet" type="text/css" /></head><body>{% body %}</body></html>expected output
abccopy1copy2copy3copy4output produced
abccopy1abccopy2abccopy3abccopy4Metadata
Metadata
Assignees
Labels
No labels