Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/tsukinoko-kun/yahp

Yet another HTML preprocessor
https://github.com/tsukinoko-kun/yahp

fetch html html-preprocessor loops node preprocessor transpiler yet-another

Last synced: about 1 month ago
JSON representation

Yet another HTML preprocessor

Awesome Lists containing this project

README

        

# yahp

[![yarn 3](https://shields.io/badge/yarn-PnP-2C8EBB?logo=yarn)](https://yarnpkg.com/features/pnp)

Yet another HTML preprocessor (for Node)

## Quickstart Guide

```bash
yarn add -D @frank-mayer/yahp
```

```typescript
import { yahp } from "@frank-mayer/yahp";
import fs from "fs";

const input: string = fs.readFileSync("./src/index.yahp", "utf8");
const output: string = await yahp(input);
fs.writeFileSync("./dist/index.html", output);
```

## Features

### Define

Define block scoped variables.

```html





```

### Eval

Run inline JavaScript Function. Return value is rendered if not undefined.

```html

const r = Math.random() * 100;
return r.toFixed(2);

```

### Fetch

Fetch content using http-get-request.

Parse response as JSON.

```html

```

Response as string.

```html

```

Response as Data URL

```html

```

### For

Iterate using any iterable.

```html

```

### If

Check if a condition is truthy or not.

Else block is not required.

```html

```

### Import

Import a Module from npm or locally.

```html

```