Skip to content

TorbenKoehn/jade-php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jade.php

Jade.php adds inline PHP scripting support to the Jade template compiler.

Implementation details

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.

What's new ?

Jade options

Jade options should be passed to the Jade construction

$jade = new Jade([
	'prettyprint' => true,
	'extension' => '.jade'
	'cache' => 'pathto/writable/cachefolder/'
]);

Supports for local variables

$data['title'] = 'Hello World';
$output = (new Jade())->render('file', $data);

Supports for custom filters

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

About

Jade template engine ported to PHP 5.3

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 78.5%
  • HTML 19.6%
  • JavaScript 1.2%
  • CSS 0.7%