
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
ember-block-slots
Advanced tools
Support for multiple yield slots, including default slots, within a component block
Target syntax is:
{{#sample-component}}
{{#block-slot 'header' as |x|}}
I am the content {{x}}
{{/block-slot}}
{{#block-slot 'main'}}
I am the content
{{/block-slot}}
{{#block-slot 'footer' as |y z|}}
I am the content {{y}} {{z}}
{{/block-slot}}
{{/sample-component}}
The component needs to yield for each slot, so the conditional in the component won't work, but we still need to handle defaults, which means that if a slot isn't provided we need an option to go back to the component template for the default. It's like we need to yield once to let all the block slots activate, but wait for the block slots to then put content back in (instead of coming from the yield? seems portal-ish)
Give credit to @runspired
This README outlines the details of collaborating on this Ember addon.
http://ciena-blueplanet.github.io/ember-block
ember install ember-block-slots
In the component template, place a "named" yield-slot block with what will be passed though for that named slot.
sammple-component.hbs
{{yield}}
{{#yield-slot 'header'}}
<div>
{{yield (block-params header 'hello' 'world')}}
</div>
{{/yield-slot}}
{{#yield-slot 'main'}}
{{yield (block-params body 'goodnight' 'moon')}}
{{else}}
Default {{sampleBody}}
{{/yield-slot}}
{{#yield-slot 'footer'}}
<div>
{{yield (block-params footer 'awesome' 'you')}}
</div>
{{/yield-slot}}
Then, in your parent template place your component with the block-slots inside, matching them by name to the yield-slot. Within each block-slot, place the content that you want to yield for that block.
parent-template.hbs
{{#sample-component sampleBody='BODY' as |slot|}}
{{#block-slot slot 'header' as |info w1 w2|}}
I am the content {{info.title}} | {{w1}} | {{w2}}
{{/block-slot}}
{{#block-slot slot 'footer' as |info w1 w2|}}
I am the content {{info.title}} | {{w1}} | {{w2}}
{{/block-slot}}
{{/sample-component}}
Given this data:
header: { title: 'HEADER' },
body: { title: 'BODY' },
footer: { title: 'FOOTER' }
The rendered output is:
I am the content HEADER | hello | world
Default BODY
I am the content FOOTER | awesome | you
git clone
this repositorynpm install
bower install
ember server
ember ember-cli-jsoc
or npm run docs
(shortcut setup in this repo)npm test
(Runs ember try:testall
to test your addon against multiple Ember versions)ember test
ember test --server
ember build
For more information on using ember-cli, visit http://ember-cli.com/.
Employs Semantic Versioning 2.0.0
0.12.3
No CHANGELOG section found in Pull Request description.
Use a # CHANGELOG
section in your Pull Request description to auto-populate the CHANGELOG.md
FAQs
Support for targeted yield slots within a component block
The npm package ember-block-slots receives a total of 509 weekly downloads. As such, ember-block-slots popularity was classified as not popular.
We found that ember-block-slots demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.