Tale\Jade\Renderer::compile PHP Method

compile() public method

The result can then be evaluated, the best method is a simple PHP include Use ->render() to get this done for you Before evaluating you should set a $__args variables that will be passed through mixins. It like a global scope. If you give it a path, the directory of that path will be used for relative includes.
public compile ( string $input, string | null $path = null ) : mixed | string
$input string the jade input string
$path string | null the path for relative includes
return mixed | string A PHTML string containing HTML and PHP
    public function compile($input, $path = null)
    {
        return $this->compiler->compile($input, $path);
    }

Usage Example

    public function testIssue18()
    {
        $jade = <<<JADE
- if (\$something):
    p Do something
- endif;



- if (\$something && \$somethingElse) {
    p Do some random stuff
- }



-
    if (\$something && \$somethingElse) {
        echo "No jade handling here";
    }

    \$array = ["a","b"
        "c", "d",
            "e", "f",
        "g",
    "h"];

p and it goes on normally...
JADE;
        $this->assertEquals('<?php if ($something):?><p>Do something</p><?php endif;?><?php if ($something && $somethingElse) {?><p>Do some random stuff</p><?php }?><?php if ($something && $somethingElse) {echo "No jade handling here"; } $array = ["a","b""c", "d","e", "f", "g", "h"];?><p>and it goes on normally...</p>', $this->_renderer->compile($jade));
    }
All Usage Examples Of Tale\Jade\Renderer::compile