diff --git a/README.md b/README.md index c974abe6a..623b289e9 100644 --- a/README.md +++ b/README.md @@ -686,12 +686,43 @@ For example, both of the following are valid and equivalent: ## Includes -Other Marko files can be included using the `` tag and a relative path. For example: +Marko supports includes/partials. Other Marko files can be included using the `` tag and a relative path. For example: ```xml ``` +The value of the `template` attribute can also be a dynamic JavaScript expression that resolves to a loaded template as shown below: + +In your controller: + +```javascript +var myIncludeTarget = require('./my-include-target.marko'); +var anotherIncludeTarget = require('./another-include-target.marko'); + + +template.render({ + myIncludeTarget: myIncludeTarget, + anotherIncludeTarget: anotherIncludeTarget + }, + ...); +``` + +And then in your template: + +```xml + + +``` + +You can also choose to load the include target within the calling template as shown below: + +```xml + +... + +``` + ## Variables Input data passed to a template is made available using a special `data` variable. It's possible to declare your own variables as shown in the following sample code: