Comments (10)
Gist: https://gist.github.com/jonschlinkert/5552311
from handlebars-helpers.
We've added nested layouts in assemble, but those don't address the specific issue that was created.
Here's an example of what we can use for this.
from handlebars-helpers.
let's do it a little differently, maybe use the options hash to determine the block type instead of duplicating the same code three times and only changing a property.
from handlebars-helpers.
+1
from handlebars-helpers.
I was thinking about this, and technically shouldn't it be possible to actually register a partial with a helper? Meaning that you could have a block helper that does something like this:
Handlebars.registerHelper("partial", function(name, options) {
Handlebars.registerPartial(name, options.fn);
});
and then in templates:
This doesn't work currently, or at least it didn't when I tried it - perhaps due to how/when partials are registered? But it seems like this would allow us to resolve this issue.
from handlebars-helpers.
See my PR #75 and let me know if this is what you're thinking. I can add the content option in the morning and we can merge it then.
from handlebars-helpers.
by "content option" I'm assuming you mean a hash for content placement? like append
, prepend
etc.? if so, yeah that's really nice. Maybe something like this?:
{{#content "append" "footer"}}
This will be appended.
{{/content}}
{{#content "prepend" "footer"}}
This will be prepended to the "foot" block
{{/content}}
{{#content "replace" "header"}}
This will replace the "header" block
{{/content}}
or even better:
{{#content append="footer"}}
This will be appended.
{{/content}}
{{#content prepend="footer"}}
This will be prepended to the "foot" block
{{/content}}
{{#content replace="header"}}
This will replace the "header" block
{{/content}}
from handlebars-helpers.
obviously we could make the hashes more verbose, but I guess that's 6 to one half dozen to the other e.g.:
{{#content "footer" block"append"}}
This will be appended.
{{/content}}
{{#content "footer" block"prepend"}}
This will be prepended to the "foot" block
{{/content}}
{{#content "header" block"replace"}}
This will replace the "header" block
{{/content}}
from handlebars-helpers.
@doowb ooh I can use this on the component stuff I started today...
from handlebars-helpers.
resolved :-) thanks @doowb
from handlebars-helpers.
Related Issues (20)
- Comparation(#compare var1 "==" var2) with two variables doesn't work HOT 1
- Upgrade for new versions of the related plugins HOT 1
- does not export a 'register' function, cannot import HOT 1
- Create SECURITY.md
- Not splitting string by line breaks '\n' HOT 1
- todo: merge updates from https://github.com/Budibase/handlebars-helpers HOT 3
- Markdown Helper is broken...
- Vulnerability found (due to highlight.js) HOT 3
- isLast in nested forEach
- Titleize handlebar doesn't titleize input string correctly.
- Request: encode to hex HOT 1
- If loading all helpers the String helper reverse overrides the Array helper reverse. HOT 2
- An examples of working out averages on columns
- Handle empty fields
- String helper `split` doesn't split by empty string.
- This package does not install
- Fumanchu - A supported Handlebar + Handlebars-Helpers together! HOT 4
- query online
- Dead? Process to transfer ownership?
- Dependency "ent" uses deprecated Node punycode module
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from handlebars-helpers.