I have Tailwind 4 working apart for Layout grid columns.
I’ve followed some guidance from other posts but am stuck on column width. I’ve run the build and wait commands but not sure if I need to run a specific command to set the safelist. Or my grid classes are not right?
/src/tailwind.css
@import "tailwindcss";
@source not "../vendor";
module.exports {
content: [
'./site/**/*.{html,js,php}',
],
safelist: [
'col-span-1',
'col-span-2',
'col-span-3',
'col-span-4',
'col-span-5',
'col-span-6',
'col-span-7',
'col-span-8',
'col-span-9',
'col-span-10',
'col-span-11',
'col-span-12'
]
}
template
<?php foreach ($page->layout()->toLayouts() as $layout): ?>
<section class="grid grid-cols-12 gap-2 mb-4" id="<?= $layout->id() ?>">
<?php foreach ($layout->columns() as $column): ?>
<div class="col-span-<?= $column->span() ?> bg-slate-300">
<div class="blocks">
<?= $column->blocks() ?>
</div>
</div>
<?php endforeach ?>
</section>
<?php endforeach ?>
output
<section class="grid grid-cols-12 gap-2 mb-4" id="cc88b508-3a3a-4031-b071-53db841d7ecc">
<div class="col-span-6 bg-slate-300">
<div class="blocks">
<h2>Row 1, 1/2, 6 columns</h2>
</div>
</div>
<div class="col-span-6 bg-slate-300">
<div class="blocks">
<h2>Row 1, 1/2, 6 columns</h2>
</div>
</div>
</section>
<section class="grid grid-cols-12 gap-2 mb-4" id="345c6bbf-f824-4d77-b185-498f6d86402b">
<div class="col-span-12 bg-slate-300">
<div class="blocks">
<h2>Row 2, 1/1, 12 columns</h2>
</div>
</div>
</section>
result
