diff --git a/README.md b/README.md index 689e55e6c..ca88f64d7 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ Syntax highlighting available for [Atom](https://atom.io/) by installing the [la - [invoke](#invoke) - [Structure Manipulation](#structure-manipulation) - [attrs](#attrs) + - [body-only-if](#body-only-if) - [Comments](#comments) - [Helpers](#helpers) - [Custom Tags and Attributes](#custom-tags-and-attributes) @@ -1019,6 +1020,30 @@ The output would then be the following: ``` +### body-only-if + +If you find that you have a wrapper element that is conditional, but whose body should always be rendered then you can use the `body-only-if` attribute to handle this use case. For example, to only render a wrapping `` tag if there is a valid URL then you could do the following: + +```html + + Some body content + +``` + +Given a value of `"http://localhost/"` for the `data.linkUrl` variable: , the output would be the following: + +```html + + Some body content + +``` + +Given a value of `undefined` for the `data.linkUrl` variable: , the output would be the following: + +```html +Some body content +``` + ## Comments Standard HTML comments can be used to add comments to your template. The HTML comments will not show up in the rendered HTML.