Skip to content
Go implementation of CSS flexbox layout algorithm, port of Facebook's Yoga
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
PATENTS
README.md
absolute_position_test.go
align_content_test.go
align_items_test.go
align_self_test.go
aspect_ratio_test.go
baseline_func_test.go
border_test.go
compute_margin_test.go
compute_padding_test.go
default_values_test.go
dimension_test.go
dirty_marking_test.go
display_test.go
edge_test.go
enums.go
flex_direction_test.go
flex_test.go
flex_wrap_test.go
had_overflow_test.go
issue5_test.go
justify_content_test.go
margin_test.go
math.go
math_test.go
measure_cache_test.go
measure_mode_test.go
measure_test.go
min_max_dimension_test.go
node_child_test.go
padding_test.go
percentage_test.go
print.go
relayout_test.go
rounding_function_test.go
rounding_measure_func_test.go
rounding_test.go
size_overflow_test.go
style_test.go
yoga.go
yoga_h.go
yoga_props.go

README.md

flex - CSS flexbox layout implementation in Go

Go implementation of flexbox CSS layout algorithm.

A pure Go port of Facebook's Yoga.

How to use

Read tutorial or look at _test.go files.

Status

The port is finished. The code works and passess all Yoga tests.

The API is awkward by Go standards but it's the best I could do given that I want to stay close to C version.

Logic is currently synced up to https://github.com/facebook/yoga/commit/f45059e1e696727c1282742b89d2c8bf06345254

How the port was made

You can read a detailed story.

In short:

  • manually ported C code to Go, line-by-line
  • manually ported tests to Go
  • tweak the API from C style to be more Go like. The structure and logic still is very close to C code (this makes porting future C changes easy)
You can’t perform that action at this time.