# cometa

> Cometa Templating Engine

Latest version **1.0.3** (published 2018-02-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install cometa
pnpm add cometa
yarn add cometa
bun add cometa
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2018-02-22 |
| First published | 2018-02-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 14.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Niccolo Borgioli |
| Maintainers | cupcakearmy |
| Keywords | Templating, Engine |

## Links

- npm: https://www.npmjs.com/package/cometa
- Repository: https://github.com/CupCakeArmy/cometa
- Homepage: https://github.com/CupCakeArmy/cometa#readme
- Issues: https://github.com/CupCakeArmy/cometa/issues
- npm.io page: https://npm.io/package/cometa

## Recent versions

- 1.0.3 (latest) — 2018-02-22
- 1.0.2 — 2018-02-22
- 1.0.1 — 2018-02-22
- 1.0.0 — 2018-02-21

## README

# Cometa

[![Build Status](https://travis-ci.org/CupCakeArmy/cometa.svg?branch=master)](https://travis-ci.org/CupCakeArmy/cometa)

> Yet another templating engine 📠

Cometa is a templating engine with **no dependencies** written in `JS`. That was the reason because it was created.

## Quickstart 💥

```bash
# Install
npm i cometa

# Run
node examples/simple/app.js
```

## Setup 🏗

### General Import

```javascript
// Import
const Cometa = require('cometa')

// Initialize
const cometa = new Cometa()
```

### Constructor parameters

- `views` [Optional] Root template folder
- `extension` [Optional] File extension for the templates
- `encoding` [Optional] Encoding to be used on the

```javascript
new Cometa({
	views: './my/views/folder',
	extension: 'html'
})
```

## Installation 🚂

```bash
npm i cometa
```

## Reference 📒

### Variable

```json
{"myVar": "ok"}
```

```html
<span>{{myVar}}</span>
```

### Comments

```html
<div>
	{{# Me Me Comment #}}
</div>
```

### If

True is everything that is different from:

- `undefined`
- `false`
- `null`
- `''`

```json
{
	"myVar": "something",
	"myVar": true,
	"myVar": [1,2,3],
	"myVar": 42,
}
```

```html
{{? myVar }}
	<span>Only show me when I exist: {{ myVar }}</span>
{{/?}}
```

### Loop

```json
{
	"links": [
		{"id":0, "name": "One"},
		{"id":1, "name": "Two"},
		{"id":2, "name": "Three"}
	]
}
```

```html
<ul>
	{{* link in links}}
		<li id="{{link.id}}">{{ link.name }}</li>
	{{/*}}
</ul>
```

---
_Source: https://npm.io/package/cometa · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
