Skip to content

Commit 4274fb2

Browse files
committed
readme
1 parent e302085 commit 4274fb2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ which in turn is equivalent to:
8585
> <div class="<%= binding.local_variable_get('class') %>">Text</div>
8686
> ```
8787
88-
#### Merging class and style attributes
88+
#### Merging `class` and `style` attributes
8989
You can specify both static and dynamic version of `class` and `style` attribute on a tag, and they will be merged.
9090
9191
For example:
@@ -94,17 +94,18 @@ For example:
9494
```
9595
is equivalent to:
9696
```erb
97-
<div class="<%= binding.local_variable_get('class').to_s + ' big' %>" class="big" style="<%= style.to_s + '; color: red' %>">Text</div>
97+
<div class="<%= binding.local_variable_get('class').to_s + ' big' %>" style="<%= style.to_s + '; color: red' %>">Text</div>
9898
```
9999

100-
This is especially useful when you want to apply a `class` and `style` attribute to a partial root and merge the dynamic local with default value. For example, if you have the following `\_button` partial:
100+
This is especially useful when you want to apply a `class` and `style` attribute to a partial root and merge the dynamic local with default value. For example, if you have the following partial:
101101
```erb
102102
<%# locals: (class: nil) -%>
103103
<button class% class="big">Button</button>
104+
```
105+
that is used as follows:
104106
```html
105-
it can be used as follows:
106107
<_button class="blue" />
107-
which will render:
108+
it will render:
108109
```html
109110
<button class="big blue">Button</button>
110111
```

0 commit comments

Comments
 (0)