pug-php / pug

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

clear layout after render #215

Closed zymanch closed 5 years ago

zymanch commented 5 years ago

Hello,

I encountered an issue with the following code: index.pug

extend layout
block content
  | test

layout.pug

html
  #title
  block content

debug_panel.pug

#debug_panel
$outputHtml = $pug->renderFile('index.pug');
$debugHtml = $pug->renderFile('debug_panel.pug');

I expected to get for $debugHtml:

<div id="debug_panel"></div>

But I actually get:

<html><div id="title"></div></div>

Problem with Layout, it saved after first renderFile but i think it must be cleared.

Thanks!

kylekatarnls commented 5 years ago

Confirmed, we have a regression.

kylekatarnls commented 5 years ago

A temporary work-around can be:

$outputHtml = $pug->renderFile('index.pug');
$pug->getRenderer()->initCompiler();
$debugHtml = $pug->renderFile('debug_panel.pug');
kylekatarnls commented 5 years ago

Please run composer update to upgrade phug/compiler and phug/renderer, it should fix it.