Acutis is a template language that features static typing, pattern matching, and asynchronous template components. You can execute your templates like scripts or compile them to self-contained JavaScript files.
Acutis is an experimental, personal project and is not stable.
{% interface
siteTitle = string
blogPosts =
[
{
title: string,
author: {name: ?string},
date: string,
image: ?{alt: string, src: string},
content: string
}
]
~%}
<h1> Blog posts for {% siteTitle %} </h1>
{%~ map blogPosts with {image, title, content, date, author: {name}} %}
<article class="h-entry">
<header>
{% match image with null ~%}
{* no image *}
{%~ with !{src, alt} ~%}
<img src="{% src %}" alt="{% alt %}">
{% /match ~%}
<h2 class="p-name"> {% title %} </h2>
<span class="p-author"> By {% name ? "Anonymous" %} </span>
<span class="dt-published"> Posted on {% date %} </span>
</header>
<div class="e-content"> {{% content %}} </div>
</article>
{%~ /map %}
See how this example compiles in the playground.
The Acutis source is written in OCaml. You can install it with the OCaml package manager, OPAM.
opam pin https://github.com/johnridesabike/acutis.git
You can use npm to install a JavaScript build of Acutis. This includes an Eleventy plugin.
Install the JavaScript package in your project:
npm install acutis-lang
Import the package in your Eleventy-powered site:
// The compiler and runtime for creating components:
import acutis from "acutis-lang";
// The Eleventy plugin:
import * as acutisEleventy from "acutis-lang/eleventy";
Clone this repository with git. Then create a development OPAM switch:
opam switch create . --deps-only --with-test --with-doc
Compile the code:
dune build
Run tests:
dune runtest
Copyright (c) 2022 John Jackson.
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.