Skip to content

Commit

Permalink
added additional section in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
emaphp committed Aug 23, 2015
1 parent 2bf2004 commit 4289937
Showing 1 changed file with 60 additions and 2 deletions.
62 changes: 60 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ While the `require` macro expects a resource that returns a function, the `inclu
```

<br>
####'br' and 'nl'
####*br* and *nl*

<br>
The `br` and `nl` macros insert a `<br>` tag and a new line respectively. They accept a optional argument with the amount of strings to insert.
Expand Down Expand Up @@ -267,7 +267,7 @@ module.exports = {
},

macros: {
'copyright': function () {
copyright: function () {
return "'<p>Copyright FakeCorp 2014 - 2015</p>'";
}
}
Expand Down Expand Up @@ -310,6 +310,64 @@ module.exports = {
}
```

<br>
####Arguments

<br>
Macros can accept an arbitrary number of arguments. Only boolean, strings and numeric types are supported.

<br>
```javascript
// File: webpack.config.js
module.exports = {
// ...

module: {
loaders: {
// ...
{ test: /\.html$/, loader: "underscore-template-loader" },
}
},

macros: {
header: function (size, content) {
return "'<h" + size + ">" + content + "</h" + size + ">'";
}
}
}
```

<br>
```html
@header(1, 'Welcome')
<p>Lorem ipsum</p>
@header(3, 'Contents')
<p>Sit amet</p>
```

<br>
####Escaping

<br>
Macro expressions can be escaped with the `\` character.

<br>
```html
@br(3)
\@nl()
@br()
```

<br>
Translates to

<br>
```html
<br><br><br>
@nl()
<br>
```

<br>
###License

Expand Down

0 comments on commit 4289937

Please sign in to comment.