https://github.com/rickbutton/yoga-wasm
The Yoga layout engine, but in WebAssembly.
https://github.com/rickbutton/yoga-wasm
Last synced: 17 days ago
JSON representation
The Yoga layout engine, but in WebAssembly.
- Host: GitHub
- URL: https://github.com/rickbutton/yoga-wasm
- Owner: rickbutton
- License: mit
- Created: 2020-04-09T00:17:21.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-12T06:31:25.000Z (almost 4 years ago)
- Last Synced: 2025-05-21T12:41:00.384Z (about 1 month ago)
- Language: C++
- Size: 49.8 KB
- Stars: 26
- Watchers: 2
- Forks: 4
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# yoga-wasm
`yoga-wasm` is a build of Facebook's [Yoga](https://github.com/facebook/yoga)
Flexbox layout engine, for JavaScript and WebAssembly.It is a drop in replacement for the [`yoga-layout`](https://www.npmjs.com/package/yoga-layout) NPM package.
## Installation
```bash
# npm
npm install --save yoga-wasm# yarn
yarn add yoga-wasm
```## Usage
You should be able to use `yoga-wasm` in the same way you would normally use `yoga-layout`:
```js
import * as yoga from "yoga-wasm";const node = yoga.Node.create();
node.setMaxWidth(100);
node.calculateLayout(100, 100, yoga.DIRECTION_LTR);
```## Prior Art
[`yoga-dom`](https://github.com/vincentriemer/yoga-dom) is another attempt to port Yoga to JS with WebAssembly. I leaned heavily on
[viankakrisna](https://github.com/viankakrisna)'s `embind` bindings when porting the latest version of Yoga's bindings from `nbind` to `embind`.## Contributing
Open a PR or file an issue!