pocesar / jade-kohana

Jade templating engine on Kohana
MIT License
2 stars 2 forks source link

jade-kohana

Jade templating engine on Kohana. This module works by compiling .jade templates to PHP files.

All compiled files goes to the application/cache/jade folder (that must be created and chmod'ed properly)

Usage

You have two options:

Use the JadeTemplate instead of ControllerTemplate

// Will look for template.jade by default, that is in views/template.jade
class Controller_Index extends JadeTemplate
{
    function action_index()
    {
        $this->template->greeting = 'Hello';
    }
}

Load the Jade views manually through JadeView class

class Controller_Index extends Controller
{
    function action_index()
    {
        $this->response->body(JadeView::factory('path/to/file.jade'));
    }
}

This module extends from Kohana_Controller and Kohana_View, so it's almost a drop-in replacement for existing controllers and views, behaves exactly like a View and $jadeView instanceof View returns true

You can, in your application folder, change the default View to use JadeView, but it will break view rendering for PHP views.

Known limitations