Files
HugoBlox-kit/modules/blox-tailwind
George Cushen a2aaa838c0 feat(preact+landing): enable Preact block rendering + reusable landing page content system
## Preact Block Integration
- Enable Preact component detection for data-driven pages:
  - Fix init.html to resolve sections_source + per-section ref before Preact detection
  - Correct resource paths: blox/* → js/hbx/blocks/* (Hugo module mounts)
  - Update libraries.html to load Preact core + compiled block scripts
- Add dynamic icon rendering for Preact components:
  - Create Icon.jsx component with SVG decoding
  - Add get_icon_data.html partial for passing icon strings to Preact props
  - Update preact-wrapper.html to fetch icon data and inject into props
  - Wire hero component to render dynamic icons via <Icon svg={icon_svg} />
- Centralized logging system:
  - Add functions/logger.html to wrap warnf/errorf safely
  - Degrade to HTML comments in constrained contexts (content adapters)

## Reusable Landing Page Content System
- Add sections_source support:
  - Page front matter: sections_source: pages/<key> loads base from data/pages/<key>.yaml
  - Inline sections deep-merge over base by position; extras appended
- Add per-section ref system:
  - Any section: ref: blocks/<slug> loads from data/blocks/<slug>.yaml
  - Inline section properties deep-merge over ref (content/design submaps)
  - Enable content reuse across multiple landing pages
- Create reusable block library:
  - Add test/data/blocks/: hero_basic.yaml, features_basic.yaml
  - Add test/content/linked/index.md demo using refs with overrides
- Add pragmatic deep merge for content/design override handling

## Infrastructure & Schemas
- Update base-block.json schema:
  - Fix gradient structure: flat → nested (gradient.start/end/direction)
  - Fix color structure: string|{light,dark} (matches parse_block_v3.html)
  - Update hero schema to properly extend base via $ref
- Fix Tailwind source path generation:
  - Add tailwind_sources.html with test vs starter site logic
  - scripts/view-test.sh: export HUGO_BLOX_TEST_SITE=true
- Update block directory structure:
  - blox/<name>/config.html (was blox/<name>--CONFIG.html)
  - Apply to init.html + parse_block_v2.html
- Code quality improvements:
  - Biome config: match Prettier rules

## Content Adapters (Removed)
- Investigated Hugo content adapters for landing pages
- Found execution context limitations (early build phase, limited site methods)
- Archived to backups/content-adapters-*.zip and removed from test site
- Decision: use standard pages + data linking instead of adapters

This enables dynamic Preact rendering with proper icon support while providing a flexible, reusable content system for landing pages that maintains the "single file = page" mental model with optional advanced linking.
2025-09-22 22:18:03 +01:00
..
2023-11-25 23:39:49 +00:00
2025-08-17 20:58:14 +01:00
2025-08-20 02:38:07 +01:00
2023-11-25 23:39:49 +00:00

Hugo Blox Tailwind UI

The Hugo Blox web framework utilizing Tailwind CSS v4 with Hugo's native integration for styling components with Tailwind v4.

Requirements

  • Hugo v0.148.2+ (Extended Edition)
  • Node.js v20+
  • pnpm (see packageManager field in package.json)

Quick Start

1. Install Dependencies

pnpm install

2. Run Development Server

hugo server

Tailwind CSS is processed automatically by Hugo using the css.TailwindCSS function.

Features

  • Tailwind CSS v4: Latest version with improved performance over Tailwind v3
  • Hugo Native Integration: Uses Hugo's built-in css.TailwindCSS function
  • Dynamic CSS Generation: Only includes utilities actually used in your content for ultra-fast page loads
  • No Pre-compilation: CSS is generated on-demand (previously Tailwind v3 was pre-compiled in Hugo Blox as wc.min.css)
  • Community Components: Community components work seamlessly without manual compilation

Configuration

The Tailwind configuration is now in CSS format at assets/css/main.css using the @theme directive. The configuration includes:

  • Hugo Blox color schemes (primary, secondary, neutral)
  • Typography settings
  • Safelist patterns for dynamic classes
  • Dark mode support

Migration from Tailwind v3

If you're upgrading from Tailwind v3:

  1. Install the new dependencies: pnpm install
  2. Remove any assets/dist/wc.min.css files
  3. Add the package.json file from the latest starter templates
  4. Update your deployment scripts to install it with pnpm install (refer to the latest .github folder in the starters)
  5. The old tailwind.config.js and postcss.config.js files are no longer needed

Development

For module development:

# Install dependencies
pnpm install

# Run development server
hugo server --disableFastRender

# Build for production
hugo --minify

Vendor Libraries

The module includes several third-party vendor libraries that are distributed with the module. These are copied from node_modules to the assets/dist/lib directory during the build process.

To update the vendor libraries:

# Update vendor libraries to the latest versions and rebuild
pnpm vendor:update-and-build

# Just rebuild vendor libraries without updating versions
pnpm vendor:libs

The following libraries are included:

  • mermaid (diagrams)
  • plotly.js (interactive charts)
  • katex (math rendering)
  • markmap-autoloader (mind maps)
  • alpinejs (interactivity)
  • preact (interactive components)