# yoga-wasm-web

Latest version **0.3.3** (published 2023-03-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install yoga-wasm-web
pnpm add yoga-wasm-web
yarn add yoga-wasm-web
bun add yoga-wasm-web
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.3 |
| Published | 2023-03-14 |
| First published | 2022-02-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 283 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | quietshu |

## Links

- npm: https://www.npmjs.com/package/yoga-wasm-web
- Repository: shuding/yoga-wasm-web
- npm.io page: https://npm.io/package/yoga-wasm-web

## Recent versions

- 0.3.3 (latest) — 2023-03-14
- 0.3.2 — 2023-02-25
- 0.3.1 — 2023-02-07
- 0.3.0 — 2023-01-09
- 0.2.0 — 2022-11-06
- 0.1.2 — 2022-08-28
- 0.1.1 — 2022-07-28
- 0.1.0 — 2022-07-06
- 0.0.9 — 2022-03-28
- 0.0.8 — 2022-02-13
- 0.0.7 — 2022-02-13
- 0.0.6 — 2022-02-13
- 0.0.5 — 2022-02-13
- 0.0.4 — 2022-02-13
- 0.0.3 — 2022-02-05
- … 2 more at https://npm.io/package/yoga-wasm-web/versions

## README

# yoga-wasm-web

[Yoga](https://github.com/facebook/yoga) but in WebAssembly and ASM.js. 

## Usage

Install with your package manager:

```sh
pnpm i yoga-wasm-web
npm i yoga-wasm-web
yarn add yoga-wasm-web
```

### ASM.js

To use the ASM.js build:

```js
import initYoga, { ALIGN_CENTER } from 'yoga-wasm-web/asm'

const Yoga = initYoga()
const node = Yoga.Node.create()
node.setAlignContent(ALIGN_CENTER)
```

### WASM

To use the WASM build (take Node.js as an example):

```js
import fs from 'fs'
import initYoga, { ALIGN_CENTER } from 'yoga-wasm-web'

const Yoga = await initYoga(
  fs.readFileSync('./node_modules/yoga-wasm-web/dist/yoga.wasm')
)

const node = Yoga.Node.create()
node.setAlignContent(ALIGN_CENTER)
```

You can use other ways to provide the WASM binary too.


## Contribution

To develop this project locally, you need to clone the repo and fetch the yoga submodule first. Also, [emcc](https://emscripten.org/docs/getting_started/downloads.html) is required to build this project too.

After that, install npm dependencies:

```sh
pnpm i
```

And run the build script:

```sh
pnpm build
```

And run the tests:

```sh
pnpm test
```

# Acknowledgements

This project was started as **opinionated** fork from [pinqy520/yoga-layout-wasm](https://github.com/pinqy520/yoga-layout-wasm)

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