What you want to use is the Twig command {% flush %}, which is equivalent to the PHP function flush(). Place it immediately after the tag </head>in your template so that it can send the current buffer to the browser. Each time you call it, it displays any output buffer, so its inclusion in the loop will work fine.
See the docs for more information .
source
share