BreadcrumbsBundle icon indicating copy to clipboard operation
BreadcrumbsBundle copied to clipboard

The spaceless tag is deprecated since Twig 2.7, use the spaceless filter instead

Open mhujer opened this issue 5 years ago • 5 comments

With a recent version of Twig I'm getting a deprecation warning because the use of the spaceless tag in the template: https://github.com/whiteoctober/BreadcrumbsBundle/blob/78214890393fa5dd9cea632873ee10e0a290b33b/Resources/views/microdata.html.twig#L1-L3

It suggests to use spaceless filter instead. But only to avoid extra whitespace between HTML tags to avoid browser rendering quirks under some circumstances.

On the other hand, it says:

If you want to optimize the size of the generated HTML content, gzip compress the output instead.

So the question is for which reason is the spaceless used here. Should it be replaced with a filter or removed?

mhujer avatar Apr 13 '19 18:04 mhujer

Waiting for this to be update. Getting too many deprecation :100:

Same is available in WhiteOctoberBreadcrumbsBundle::json-ld.html.twig

manu-sparheld avatar Jun 21 '19 08:06 manu-sparheld

I imagine that the reasons for this tag are lost in the mists of time. If you've the time, I'd recommend simply experimenting with removing it locally and checking that the output is sensible. If it is, you could make a PR to remove it permanently.

It's worth bearing #106 in mind - we've unfortunately little time for work with this project now, sorry!

sampart avatar Jun 22 '19 15:06 sampart

@sampart @manu-sparheld I'm using this bundle in several projects, so I plan to have a look at this issue over the summer and eventually maintain a fork - as suggested in #106

mhujer avatar Jun 30 '19 12:06 mhujer

That's great. Thank you, @mhujer! Once your fork is at an advanced enough stage, add a note onto #106 and we can look into updating the README to point to it. Thanks again.

sampart avatar Jul 01 '19 20:07 sampart

Fixed this in my fork (see https://github.com/whiteoctober/BreadcrumbsBundle/issues/106#issuecomment-525323526) with a simple change: https://github.com/mhujer/BreadcrumbsBundle/commit/5cb54766dc71b700ff1ad8b7a7caffa98b0845fb

mhujer avatar Aug 27 '19 14:08 mhujer