pug-php / pug

Pug template engine for PHP
https://www.phug-lang.com
MIT License
391 stars 42 forks source link

include, extends #63

Closed jorjsmile closed 8 years ago

jorjsmile commented 8 years ago

in my index.pug I have

include front/header.pug

Compiler always tell's : "Page not found." Looking at source of vendor/pug-php/pug/src/Jade/Jade.php:compile:217 method - I see:

$parser = new Parser($input, null, $this->options);

Mb, it should be

$parser = new Parser($input, $FILENAME, $this->options);

So the parser could detected local directory name? And after load dependency?

jorjsmile commented 8 years ago

Ok, got it. If I will send to compile not source, but a file - it will render properly. But I think you should extend method compile, so it take 2nd parameter, of filename.

kylekatarnls commented 8 years ago

Hi,

The right way to do it is to specify the basedir option to your templates folder and specify absolutes pathes.

Else if you work with include and extends it would be a bad idea to render raw sources instead of files pathes.