Open daytonlowell opened 4 years ago
👍 this is something I've run into as well and should be fairly simple to add.
It just occurred to me that you could also supply a default partial (see foo
) in the component to avoid this e.g.
Ractive.extend({
template: '<div>{{yield something}}</div>',
partials: {
something: []
}
});
Would that be an acceptable workaround, or is optional syntax more clear here? From the perspective of a function call, function fn(foo?: Foo)
and function fn(foo: Foo = {})
are subtly but definitely different.
The optional syntax may be more clear, but supplying a default partial totally works for my use case. Thanks.
Description:
Currently, if you have a partial that never gets referenced, Ractive will put a warning in the console like
Sometimes I would like to mark a partial as optional. This comes up most often in components where I'll created named yields that the consumer of the component may not be interested in actually using(depending on their use-case).
Perhaps something like
{{yield?}}
and{{>?}}
would suppress the warning.Versions affected:
all
Platforms affected:
all
Reproduction:
N/A