Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tatut/re-html-template

Generate hiccup (reagent/server rendering) components from HTML templates at compile time
https://github.com/tatut/re-html-template

Last synced: 3 months ago
JSON representation

Generate hiccup (reagent/server rendering) components from HTML templates at compile time

Awesome Lists containing this project

README

        

# re-html-template

Re-html-template can create Reagent components (functions that return hiccup markup) from HTML
templates at compile time.

See the macros `html-template` and `define-html-template`.

## Changes

### 2021-09-05
- Support :translate option to globally supply a translation form

### 2021-08-31
- Support (experimental) for automatic reloading (and re-eval of code) when template file changes (`:reload? true`)
- Support merging global options as REPL convenience with `merge-global-options!`

### 2021-08-15
- Support reusable transforms via macros

### 2021-08-14
- Filter out empty classes
- Support custom matcher types (see `custom-match-element`)
- Support :remove-attributes transform (eg. to remove data- attribute used for matching purpose from output)
- Support :default-transformations that are run for all elements matched by any rule
- Support illegal (in clj keyword) chars in classes (represented in :class attribute instead)

### 2021-01-12
- Add :wrap transform support
- Add `html` macro that does just expansion without generating a function

### 2021-01-11
- Remove project.clj (last clojars version is 20180504)

### 2021-01-10
- Support attr maps as rules
- Support global options that are merged with options given at call site
- New `html-template` that expands to an anonymous function and refactor
`define-html-template` to use that
- Usage as deps.edn git dependency
- `:wrap-hiccup` option to support different other approaches than returning hiccup

## Goals

- Simple macro that outputs a function
- Both Clojure and ClojureScript support
- Zero runtime dependencies (outputs plain clojure code that doesn't need any libraries)

## Usage

If you have the following HMTL file in your classpath `template.html`:

```html

My template



Links: