Jade.php adds inline PHP scripting support to the Jade template compiler.
The fork is a complete rewrite, all the code is ported from the original jade project.
All the features from the original are supported but undertested, including inheritance and mixins.
kylekatarnls/jade-php on packagist.org
Jade options should be passed to the Jade construction
$jade = new Jade(array(
'prettyprint' => true,
'extension' => '.jade',
'cache' => 'pathto/writable/cachefolder/'
);
$data['title'] = 'Hello World';
$jade = new Jade();
$output = $jade->render('file', $data);
Filters must be callable: It can be a class that implements the __invoke() method, or an anonymous function.
$jade->filter('escaped', 'My\Callable\Class');
// or
$jade->filter('escaped', function($node, $compiler){
foreach ($node->block->nodes as $line) {
$output[] = $compiler->interpolate($line->value);
}
return htmlentities(implode("\n", $output));
});
Built-in filters:
- :css
- :php
- :javascript
- :escaped
- :cdata