v7.1.0
You can use appendContent
and prependContent
modes to add child nodes to content.
block('quote')(
prependContent()('“'), // add some things before actual content
appendContent()('”'), // add content to the end
appendContent({ block: 'link' }); // add more content to the end
);
{ block: 'quote', content: 'I came, I saw, I templated.' }
Result:
<div class="quote">“I came, I saw, I templated.”<div class="link"></div></div>
appendContent()
and prependContent()
is a shortcuts to content()
+ applyNext()
:
// appendContent() is the same as:
content()(function() {
return [
applyNext(),
'additional content'
];
});
// prependContent() is the same as:
content()(function() {
return [
'additional content',
applyNext()
];
});
Commits:
- [
b59973d5b2
] - Merge pull request #337 from bem/content-mods (Slava Oliyanchuk) - [
bfc4e09c0c
] - Tests: identify test is slow on Travis. Accuracy changed. (miripiruni)