Closed hustlahusky closed 7 years ago
I'm using pug-php with nodejs pug-cli and found that slashes in locals had escaped by json_encode. It breaks all urls stored in locals.
For example, I have store favicon path in locals array:
$LOCALS['site'] = [ 'colorScheme' => 'none', 'favicon' => '/favicon.png' ];
And then i'm use it in my pug template:
link(rel="shortcut icon", href=site.favicon, type="image/png")
I'm getting broken favicon path on rendered page:
<link rel="shortcut icon" href="\/favicon.png" type="image/png">
Is there way to pass some options to json_encode, like JSON_UNESCAPED_SLASHES etc.?
It probably should be the default. I create a unit test to reproduce the case.
Confirmed, soon fixed
Thanks for the help, please upgrade to 2.6.4 to get fixed escape.
I'm using pug-php with nodejs pug-cli and found that slashes in locals had escaped by json_encode. It breaks all urls stored in locals.
For example, I have store favicon path in locals array:
And then i'm use it in my pug template:
I'm getting broken favicon path on rendered page:
Is there way to pass some options to json_encode, like JSON_UNESCAPED_SLASHES etc.?