From 707b1f1ce10a5843ef959abdc17094fc0ff2bce8 Mon Sep 17 00:00:00 2001 From: Alex Dunmow Date: Sun, 5 Jul 2026 17:56:00 +0800 Subject: [PATCH] refactor: replace hand-rolled utility CSS with Tailwind classes (host build now scans theme templates) --- assets/style.css | 22 +++-------------- manifest.yaml | 24 ++++--------------- templates/overrides/coffee/hero.ninjatpl | 6 ++--- .../overrides/coffee/hours-location.ninjatpl | 2 +- templates/overrides/coffee/menu-list.ninjatpl | 2 +- 5 files changed, 13 insertions(+), 43 deletions(-) diff --git a/assets/style.css b/assets/style.css index dd435f8..1f771bb 100644 --- a/assets/style.css +++ b/assets/style.css @@ -182,29 +182,13 @@ body.coffee-paper { } /* --- Layout helpers ------------------------------------------------------ - * Explicit CSS so these layouts never depend on the host Tailwind JIT - * compiling arbitrary/responsive utilities out of THEME templates — it does - * not scan them reliably, so `min-h-[50vh]` / `md:grid-cols-[2fr_3fr]` / - * `md:grid-cols-2` in a theme file can silently vanish. Base is always a - * single column, so grids collapse on mobile regardless of the JIT. */ -.coffee-minh-50 { min-height: 50vh; } -.coffee-minh-75 { min-height: 75vh; } -.coffee-minh-screen { min-height: 100vh; } -.coffee-minh-400 { min-height: 400px; } -.coffee-minh-320 { min-height: 320px; } - -.coffee-split-2 { display: grid; grid-template-columns: 1fr; } + * coffee-pour-grid keeps an explicit md 2fr:3fr split — a non-standard grid + * ratio with no plain Tailwind utility. Single-column base collapses on + * mobile. */ .coffee-pour-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; } -.coffee-menu-grid { display: grid; grid-template-columns: 1fr; gap: 2.5rem 3rem; } -.coffee-info-grid { display: grid; grid-template-columns: 1fr; gap: 2.5rem; } @media (min-width: 768px) { .coffee-pour-grid { grid-template-columns: 2fr 3fr; align-items: center; } - .coffee-menu-grid.coffee-menu-grid--2 { grid-template-columns: 1fr 1fr; } - .coffee-info-grid.coffee-info-grid--2 { grid-template-columns: 1fr 1fr; } -} -@media (min-width: 1024px) { - .coffee-split-2 { grid-template-columns: 1fr 1fr; } } /* --- Price + spec chips ------------------------------------------------- */ diff --git a/manifest.yaml b/manifest.yaml index d1f94d3..72344ae 100644 --- a/manifest.yaml +++ b/manifest.yaml @@ -290,29 +290,15 @@ css: } /* --- Layout helpers ------------------------------------------------------ - * Explicit CSS so these layouts never depend on the host Tailwind JIT - * compiling arbitrary/responsive utilities out of THEME templates — it does - * not scan them reliably, so `min-h-[50vh]` / `md:grid-cols-[2fr_3fr]` / - * `md:grid-cols-2` in a theme file can silently vanish. Base is always a - * single column, so grids collapse on mobile regardless of the JIT. */ - .coffee-minh-50 { min-height: 50vh; } - .coffee-minh-75 { min-height: 75vh; } - .coffee-minh-screen { min-height: 100vh; } - .coffee-minh-400 { min-height: 400px; } - .coffee-minh-320 { min-height: 320px; } - - .coffee-split-2 { display: grid; grid-template-columns: 1fr; } + * coffee-pour-grid keeps an explicit md 2fr:3fr split — a non-standard grid + * ratio with no plain Tailwind utility. Single-column base collapses on + * mobile. (The min-height + standard-column grid helpers that used to live + * here are now plain Tailwind utilities in the templates, since the host + * build scans theme .ninjatpl files.) */ .coffee-pour-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; } - .coffee-menu-grid { display: grid; grid-template-columns: 1fr; gap: 2.5rem 3rem; } - .coffee-info-grid { display: grid; grid-template-columns: 1fr; gap: 2.5rem; } @media (min-width: 768px) { .coffee-pour-grid { grid-template-columns: 2fr 3fr; align-items: center; } - .coffee-menu-grid.coffee-menu-grid--2 { grid-template-columns: 1fr 1fr; } - .coffee-info-grid.coffee-info-grid--2 { grid-template-columns: 1fr 1fr; } - } - @media (min-width: 1024px) { - .coffee-split-2 { grid-template-columns: 1fr 1fr; } } /* --- Price + spec chips ------------------------------------------------- */ diff --git a/templates/overrides/coffee/hero.ninjatpl b/templates/overrides/coffee/hero.ninjatpl index 4fae2af..f306857 100644 --- a/templates/overrides/coffee/hero.ninjatpl +++ b/templates/overrides/coffee/hero.ninjatpl @@ -22,14 +22,14 @@ {% if trustLogos %}

Regulars love

{% for logo in trustLogos %}{% if logo.url %}{% img logo.image alt=logo.alt class="h-8 w-auto" %}{% else %}{% img logo.image alt=logo.alt class="h-8 w-auto opacity-60" %}{% endif %}{% endfor %}
{% endif %} {% endmacro %} {% if variant == "split" %} -
-
{% if hasImage %}{% img backgroundImage alt=headlineText class="absolute inset-0 h-full w-full object-cover" layout="hero" %}{% endif %}
+
+
{% if hasImage %}{% img backgroundImage alt=headlineText class="absolute inset-0 h-full w-full object-cover" layout="hero" %}{% endif %}
{{ herocontent("left") }}
{% else %} {% set align = "center" %} {% if variant == "left-aligned" %}{% set align = "left" %}{% endif %} -
+
{% if hasImage %}
{% img backgroundImage alt=headlineText class="h-full w-full object-cover" layout="hero" %}{% if showOverlay %}
{% endif %}
{% endif %}
{{ herocontent(align) }}
diff --git a/templates/overrides/coffee/hours-location.ninjatpl b/templates/overrides/coffee/hours-location.ninjatpl index 9abb39c..5045c63 100644 --- a/templates/overrides/coffee/hours-location.ninjatpl +++ b/templates/overrides/coffee/hours-location.ninjatpl @@ -1,7 +1,7 @@
{% if heading %}

{{ heading }}

{% endif %} -
+
{% if hours %} diff --git a/templates/overrides/coffee/menu-list.ninjatpl b/templates/overrides/coffee/menu-list.ninjatpl index 390d623..c18fec4 100644 --- a/templates/overrides/coffee/menu-list.ninjatpl +++ b/templates/overrides/coffee/menu-list.ninjatpl @@ -3,7 +3,7 @@ {% if heading %}

{{ heading }}

{% endif %} {% if intro %}

{{ intro }}

{% endif %}
-
+
{% for section in sections %}