Skip to content

Inception Discussion #1

Description

@librasteve

PLEASE DO CHIME IN WITH YOUR THOUGHTS

My personal idea for this module is:

To have a raku module that does this set of things around HTMX (see htmx.org):

  • write web pages in an "Elm-like style" in raku
    • export all HTML tag names as raku subs
    • provide HTML tag attrs as raku attrs
      • maybe with error checking but this can come later
  • support HTMX on the same level as HTML
    • the idea being that with HTMX we can write a somewhat dynamic site without needing a framework
    • usual caveats about HTMX not suitable for web apps like Google Maps or very high scale deployments
  • do something sensible with CSS
    • initially mirror the CSS approach used in the source of the htmx.org site
    • open to consider other options (tailwind, bootstrap...??)
  • provide a script that can be hooked to directory changes to rebuild the html
    • eg. mypage.rakuhtmx => mypage.html (with the htmx script included)

Here is my take on "Elm-like style" from here

Note that this module conceptually is aligned just to Elm import Html and import Html.Attributes and deliberately excludes the more dynamic bits of Elm which is why this example is chosen as representative. Why not - well dynamic behaviours come from HTMX!

module HomePage exposing (main)

import Html exposing (..)
import Html.Attributes exposing (..)

view model =
    div [ class "jumbotron" ]
        [ h1 [] [ text "Welcome to Dunder Mifflin!" ]
        , p []
            [ text "Dunder Mifflin Inc. (stock symbol "
            , strong [] [ text "DMI" ]
            , text <|
                """ 
                ) is a micro-cap regional paper and office 
                supply distributor with an emphasis on servicing 
                small-business clients.
                """
            ]
        ]

main =
    view "dummy model"

So in raku source code style, that would be something like:

use HTML::Functional;

my $page = HTMX.new;

$page.body =

    div (:class<jumbotron>,
        [
        h1 "Welcome to Dunder Mifflin!",

        p  "Dunder Mifflin Inc. (stock symbol {strong 'DMI'}" ~
            q:to/END/;
                is a micro-cap regional paper and office 
                supply distributor with an emphasis on servicing 
                small-business clients.
            END
        ] );

Hopefully the syntactic intent of using standard raku quoting, sub & attribute constructs is clear - even if I butchered the example a bit.

There would be decent defaults for header and so on to avoid having to do the boilerplate incantations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions