Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/tsukinoko-kun/yahp
- Owner: tsukinoko-kun
- License: mit
- Created: 2022-04-22T14:48:42.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-05-27T21:42:10.000Z (over 2 years ago)
- Last Synced: 2024-04-15T16:59:08.938Z (9 months ago)
- Topics: fetch, html, html-preprocessor, loops, node, preprocessor, transpiler, yet-another
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@frank-mayer/yahp
- Size: 281 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
```