Skip to content

Instantly share code, notes, and snippets.

@fitnr
Created January 9, 2014 19:48
Show Gist options
  • Save fitnr/8340708 to your computer and use it in GitHub Desktop.
Save fitnr/8340708 to your computer and use it in GitHub Desktop.
Reduced test case for assemble variable scope bug
---
title: Page A
---
I use the default template. No scripts here!
---
layout: special.hbs
title: special page
---
I'm a special page. I have scripts.
---
title: x
---
I also use the default layout. No scripts?
module.exports = function(grunt) {
grunt.initConfig({
// Build HTML from templates and data
assemble: {
options: {
layoutdir: 'layouts',
layout: 'default.hbs',
},
example: {
files: {
'dest/': ['content/*']
}
}
},
});
grunt.loadNpmTasks('assemble');
};
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{ title }}</title>
{{#if scripts }}
{{#each scripts }}
<script src="{{ this }}"></script>
{{/each }}
{{/if }}
</head>
<body>
{{> body }}
</body>
</html>
---
layout: default.hbs
scripts:
- foo.js
- bar.js
---
<!-- special things -->
{
"name": "variable scope testing",
"description": "testing",
"devDependencies": {
"assemble": "~0.4.30"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment