Hi there,
here’s my code to render a layout field:
<?php foreach ($page->layout()->toLayouts() as $layout): ?>
<section class="grid grid-cols-1 md:grid-cols-<?= $layout->columns()->count() ?> first:justify-items-center gap-x-8">
<?php foreach ($layout->columns() as $column): ?>
<div >
<div class="blocks my-4">
<?= $column->blocks() ?>
</div>
</div>
<?php endforeach ?>
</section>
<?php endforeach ?>
As you can see, I have grid-cols-1 md:grid-cols-<?= $layout->columns()->count() ?>
in place to adapt to the number of columns from my template.
Thing is, as md:grid-cols-<?= $layout->columns()->count() ?>
is dynamic then Tailwind doesn’t generate the utilities needed in the css and it doesn’t work.
I’m not sure there is the solution is on Tailwind or Kirby side. Wonder if any around has encountered this kind of issue. Help would be greatly appreciated.
Thanks