Air

Air

Breathing life into the raku hArc stack (HTMX, Air, Red, Cro).

Air aims to be the purest possible expression of HTMX.

hArc websites are written in functional code. This puts the emphasis firmly onto the content and layout of the site, rather than boilerplate markup that can often obscure the intention.

Air is basically a set of libraries that produce HTML code and serve it using Cro.

The result is a concise, legible and easy-to-maintain website codebase.

SYNOPSIS

#!/usr/bin/env raku

use Air::Functional :BASE;
use Air::Base;

my &index = &page.assuming( #:REFRESH(1),
    title       => 'hÅrc',
    description => 'HTMX, Air, Red, Cro',
    footer      => footer p ['Aloft on ', b safe 'Åir'],
);


my &planets = &table.assuming(
    :thead[["Planet", "Diameter (km)",
            "Distance to Sun (AU)", "Orbit (days)"],],
    :tbody[["Mercury",  "4,880", "0.39",  "88"],
           ["Venus"  , "12,104", "0.72", "225"],
           ["Earth"  , "12,742", "1.00", "365"],
           ["Mars"   ,  "6,779", "1.52", "687"],],
    :tfoot[["Average",  "9,126", "0.91", "341"],],
);


sub SITE is export {
    site #:bold-color<blue>,
        index
            main
                div [
                    h3 'Planetary Table';
                    planets;
                ]
}

GETTING STARTED

Install raku - eg. from rakubrew, then:

Install Air, Cro & Red
- zef install --/test cro
- zef install Red --exclude="pq:ver<5>"
- zef install Air

Run and view some examples
- git clone https://github.com/librasteve/Air-Examples.git && cd Air-Examples
- export WEBSITE_HOST="0.0.0.0" && export WEBSITE_PORT="3000"
- raku -Ilib service.raku
- browse to http://localhost:3000

Cro has many other options as documented at Cro for deployment to a production server.

DESCRIPTION

Air is not a framework, but a set of libraries. Full control over the application loop is retained by the coder.

Air does not provide an HTML templating language, instead each HTML tag is written as a subroutine call where the argument is a list of @inners and attributes are passed via the raku Pair syntax :name<value>. Cro templates are great if you would rather take the template approach.

Reusability is promoted by the structure of the libraries - individuals and teams can create and install your own libraries to encapsulate design themes, re-usable web components and best practice.

Air is comprised of four core libraries:

Air also has a plugin system, for example:

  • Air::Plugin::Hilite - code highlighter

Air::Examples is a companion raku module with various Air website examples.

The Air documentation is at https://librasteve.github.io/Air

TIPS & TRICKS

  • When debugging, use the raku note sub to out put debuggin info to stderr (ie in the Cro Log stream)

  • When passing a 2D Array to a tag function, make sure that there is a trailing comma :tbody[["Mercury", "4,880", "0.39", "88"],]

  • An error message like insufficient arguments is often caused by separating two tag functions with a comma , instead of a semicolon ;

  • In development set CRO_DEV=1 in the environment

AUTHOR

Steve Roe [email protected]

The Air::Component module provided is based on an early version of the raku Cromponent module, author Fernando Corrêa de Oliveira [email protected], however unlike Cromponent this module does not use Cro Templates.

COPYRIGHT AND LICENSE

Copyright(c) 2025 Henley Cloud Consulting Ltd.

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.

Air v0.1.32

Just build websites the right way.

Authors

  • librasteve

License

Artistic-2.0

Dependencies

UUID::V4:ver<1.0.0>:auth<zef:masukomi>:api<1>CSS::Writer:ver<0.3.3>:auth<zef:dwarring>DateTime::Format:ver<0.1.5>:auth<zef:raku-community-modules>:api<1.0>HTML::Escape:ver<0.0.1>Cro::HTTP:ver<0.8.13>:auth<zef:cro>:api<0>Cro::WebApp:ver<0.10.1>:auth<zef:cro>:api<0>Cromponent:ver<0.0.13>:auth<zef:FCO>Text::Markdown:ver<1.1.1>:auth<zef:JJMERELO>YAMLish:ver<0.1.2>:auth<zef:leont>

Test Dependencies

Provides

  • Air
  • Air::Base
  • Air::Base::Elements
  • Air::Base::Tags
  • Air::Base::Tools
  • Air::Base::Widgets
  • Air::Component
  • Air::Form
  • Air::Functional

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.