BKWLD / laravel-haml

Wraps MtHaml for ease use in Laravel
MIT License
45 stars 10 forks source link

Add an API to use everywhere #4

Closed weotch closed 10 years ago

weotch commented 10 years ago

It can be a nuisance to add the compile line in each controller.

weotch commented 10 years ago

Check out laravel/framework/src/Illuminate/View/Environment.php, there are some events that get fired when a view is made. Specifically, I think the 'creating' event is what we want. It allows logic to be fired before the view is rendered. I'm thinking that maybe an event listener could listen to all such events (if running locally), check for a HAML view, and compile it, before continuing.