pug-php / pug

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

invalid cache created when including inline css #214

Closed narirou closed 5 years ago

narirou commented 5 years ago

Hello,

When creating a cache with the following code by cacheDirectory method:

//- test.pug
doctype html

html
    head
        style(amp-custom)
            include ./test.css
    body
// test.css
.test-class { color: red; }

We assumed that caches will be created including css file according to the following documents https://www.phug-lang.com/#including-plain-text

But cache file(php) created without css, like this:

<!-- ..... -->
<!DOCTYPE html><html><head><style<?= (is_bool($_pug_temp = $pugModule['Phug\\Formatter\\Format\\HtmlFormat::attributes_assignment'](array(  ), ['amp-custom' => true])) ? var_export($_pug_temp, true) : $_pug_temp) ?>></style></head><body></body></html>

And an error will occur when displaying this file using Phug\Optimiser::displayFile.

Thanks!

kylekatarnls commented 5 years ago

I can't reproduce it, when I run this, I get the test.css content inside the cache file.

What is you Pug-php/Phug version and what PHP code do you use to render/display the pug file?

narirou commented 5 years ago

We will prepare the environment where problem occurs. Thanks.

kylekatarnls commented 5 years ago

I close this for now, I will reopen if you can provide a minimal test case to reproduce the bug.

Thanks.