yoga

Yoga is a cross-platform layout engine which implements Flexbox. Follow https://twitter.com/yogalayout for updates.

  • Owner: facebook/yoga
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

Yoga CocoaPods npm bintray NuGet

Building

Yoga builds with buck. Make sure you install buck before contributing to Yoga. Yoga's main implementation is in C++, with bindings to supported languages and frameworks. When making changes to Yoga please ensure the changes are also propagated to these bindings when applicable.

Testing

For testing we rely on gtest as a submodule. After cloning Yoga run git submodule init followed by git submodule update.

For any changes you make you should ensure that all the tests are passing. In case you make any fixes or additions to the library please also add tests for that change to ensure we don't break anything in the future. Tests are located in the tests directory. Run the tests by executing buck test //:yoga.

Instead of manually writing a test which ensures parity with web implementations of Flexbox you can run gentest/gentest.rb to generate a test for you. You can write html which you want to verify in Yoga, in gentest/fixtures folder, such as the following.

<div id="my_test" style="width: 100px; height: 100px; align-items: center;">
  <div style="width: 50px; height: 50px;"></div>
</div>

Run gentest/gentest.rb to generate test code and re-run buck test //:yoga to validate the behavior. One test case will be generated for every root div in the input html.

You may need to install the latest watir-webdriver gem (gem install watir-webdriver) and ChromeDriver to run gentest/gentest.rb Ruby script.

.NET

.NET testing is not integrated in buck yet, you might need to set up .NET testing environment. We have a script which to launch C# test on macOS, csharp/tests/Facebook.Yoga/test_macos.sh.

Benchmarks

Benchmarks are located in benchmark/YGBenchmark.c and can be run with buck run //benchmark:benchmark. If you think your change has affected performance please run this before and after your change to validate that nothing has regressed. Benchmarks are run on every commit in CI.

JavaScript

Installing through NPM

npm install yoga-layout

By default this will install the library and try to build for all platforms (node, browser asm, and standalone webpack). You may receive errors if you do not have the required platform development tools already installed. To preset the platform you'd like to build for you can set a .npmrc property first.

npm config set yoga-layout:platform standalone

This will now only run the standalone webpack build upon install.

Build Platforms, name, description, ----------------, -------------------------------------------------, all (default), Builds all of these platforms., browser, Builds asm js browser version., node, Builds node js version., standalone, Runs webpack., none, Does nothing. You can use the prepackaged libs.

Main metrics

Overview
Name With Ownerfacebook/yoga
Primary LanguageC++
Program languageC (Language Count: 15)
Platform
License:MIT License
所有者活动
Created At2014-04-07 01:37:37
Pushed At2025-05-14 01:23:59
Last Commit At
Release Count59
Last Release Namev3.2.1 (Posted on )
First Release Name0.0.3 (Posted on 2015-08-18 19:38:55)
用户参与
Stargazers Count17.7k
Watchers Count388
Fork Count1.5k
Commits Count2.6k
Has Issues Enabled
Issues Count658
Issue Open Count90
Pull Requests Count104
Pull Requests Open Count25
Pull Requests Close Count996
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private