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

https://github.com/goat-framework/lamb

Go templating engine
https://github.com/goat-framework/lamb

framework golang package template template-engine

Last synced: 3 months ago
JSON representation

Go templating engine

Awesome Lists containing this project

README

          

[![Test](https://github.com/goat-framework/lamb/actions/workflows/go.yml/badge.svg)](https://github.com/goat-framework/lamb/actions)
[![Report Card](https://goreportcard.com/badge/github.com/goat-framework/lamb)](https://goreportcard.com/report/github.com/goat-framework/lamb)
![License](https://img.shields.io/github/license/goat-framework/lamb)

# Lamb

Intuitive templating engine for Go!

## Directives

These new directives clean up your templates making them easy as pie to read!

```

Title


@if LoggedIn

Hello {{ User }}


@else
Login
@end
```

These directives compile directly into the standard libary's syntax!

```

Title


{{ if .LoggedIn }}

Hello {{ .User }}


{{ else }}
Login
{{ end }}
```

Easier on the eyes right?

## UI Components

Having troubles reusing components in your application?
Check out the ui components.

_main.lamb.html_
```


Submit

```

_components/input.lamb.html_
```

```

_compiled_
```


Submit

```

## Wrap UI Components

Need to wrap some content in a custom component?

_main.lamb.html_
```


Submit

```

_components/button.lamb.html_
```

```

_compiled_
```


Submit

```

## Create Themes With Ease

Let's mix and match to create an awesome form!

_main.lamb.html_
```

Email

Name

Submit

```

_components/form.lamb.html_
```

```

_components/label.lamb.html_
```

```

_components/input.lamb.html_
```

```

_components/button.lamb.html_
```

```

_compiled_
```

Email

Name

Submit

```

## Pass Attributes Down To Components

My labels and inputs need special attributes for each component!

Here's how to implement that.

_main.lamb.html_
```
Email

```

_label.lamb.html_
```

```

_input.lamb.html_
```

```

_compiled_
```
Email

```