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

https://github.com/markmead/alpinejs-tash

Use a more familiar syntax when rendering Alpine JS {variables} 🚀
https://github.com/markmead/alpinejs-tash

alpine alpinejs templating

Last synced: 13 days ago
JSON representation

Use a more familiar syntax when rendering Alpine JS {variables} 🚀

Awesome Lists containing this project

README

        

# Alpine JS Tash

![](https://img.shields.io/bundlephobia/min/alpinejs-tash)
![](https://img.shields.io/npm/v/alpinejs-tash)
![](https://img.shields.io/npm/dt/alpinejs-tash)
![](https://img.shields.io/github/license/markmead/alpinejs-tash)

Use a more familiar syntax when rendering Alpine JS `{variables}` 🚀

Alpine JS Tash (Template Hash) lets you use templating syntax from popular
frameworks to render Alpine JS data. Instead of writing `x-text` expressions,
simply use curly braces like React, Vue, or Angular in your markup.

## Features

- 💊 Framework-familiar syntax (`{variable}`, `{{ variable }}`, etc.)
- 🔄 Fully reactive with Alpine JS data
- ðŸŽĻ Multiple template styles (React/Svelte, Vue, Angular)
- ðŸŠķ Lightweight addition to your Alpine JS projects
- ðŸ§Đ Simple plugin integration

## Why Use Tash?

Tash makes Alpine JS templates more readable and familiar, especially if you're
coming from other frameworks. It simplifies string interpolation without
sacrificing Alpine JS reactivity system.

## Install

### CDN

```html

```

### Package

```shell
yarn add -D alpinejs-tash
npm install -D alpinejs-tash
```

```js
import Alpine from 'alpinejs'
import tash from 'alpinejs-tash'

Alpine.plugin(tash)

window.Alpine = Alpine

Alpine.start()
```

## Example

```html



Hello, I am {name}! I am {age} years old and I currently work at {company}!



```

## Options

## Template Syntax Options

Alpine JS Tash supports different template syntax styles to match your
preference:

### Default: React/Svelte Style

```html


Hello, {name}!



```

### Vue Style

```html


Hello, {{ name }}!



```

### Angular Style

```html


Hello, {{name}}!



```

Choose the syntax that feels most comfortable based on your background or
project requirements.