2017 © Pedro Peláez
 

library jadephp

HAML-like template engine for PHP 5.3

image

ronan-gloo/jadephp

HAML-like template engine for PHP 5.3

  • Sunday, October 20, 2013
  • by ronan-gloo
  • Repository
  • 5 Watchers
  • 28 Stars
  • 165 Installations
  • CSS
  • 0 Dependents
  • 0 Suggesters
  • 22 Forks
  • 10 Open issues
  • 1 Versions
  • 1 % Grown

The README.md

Jade.php

Jade.php adds inline PHP scripting support to the Jade template compiler., (*1)

The Jade Syntax Reference

Implementation details

The fork is a complete rewrite, all the code is ported from the original jade project., (*2)

All the features from the original are supported but undertested, including inheritance and mixins., (*3)

What's new ?

Jade options

Jade options should be passed to the Jade construction, (*4)

$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., (*5)

$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:, (*6)

  • :css
  • :php
  • :javascript
  • :escaped
  • :cdata

The Versions

20/10 2013

dev-master

9999999-dev https://github.com/ronan-gloo/jade.php

HAML-like template engine for PHP 5.3

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

template jade minification