Skip to content

Commit

Permalink
Update index.md
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldrapper committed Jan 30, 2024
1 parent fbc98d3 commit 2307bdd
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,25 +137,24 @@ end
### Hooks
[//]: # (We should also add an example of around_template)

You can hook into the rendering process by overriding `before_template` and `after_template` which are called immediately before / after the template is rendered.
You can hook into the rendering process by overriding `before_template` and `after_template` which are called immediately before and after the template is rendered.

It’s a good idea to call `super` to allow for inherited callbacks.
You should always call `super` from these methods to allow for inherited callbacks.

```phlex
class Example < Phlex::HTML
def before_template
h1 { "Hello" }
h1 { "Before" }
super
end
def template
h2 { "World" }
h2 { "Hello World!" }
end
def after_template
h3 { "Bye" }
super
h3 { "After" }
end
end
```
Expand Down

0 comments on commit 2307bdd

Please sign in to comment.