Skip to content

Commit

Permalink
Documentation on README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
andymeneely committed Sep 22, 2014
1 parent 9de7f31 commit 67741f7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion README.md
Expand Up @@ -173,7 +173,7 @@ Layouts will override Squib's defaults, but are overriden by anything specified

Since Layouts are in Yaml, we have the full power of that data format. One particular feature you should look into are ["merge keys"](http://www.yaml.org/YAML_for_ruby.html#merge_key). With merge keys, you can define base styles in one entry, then include those keys elsewhere. For example:

```sh
```yaml
icon: &icon
width: 50
height: 50
Expand All @@ -183,6 +183,18 @@ icon_left
# The layout for icon_left will have the width/height from icon!
```

Also!! Squib provides a more feature-rich way of merging: the `extends` key in layouts. When defining an extends key, we can merge in another key and modify data coming in if we want to. This allows us to do things like set an inner object that changes its location based on its parent.

```yaml
yin:
x: 100
y: 100
radius: 100
yang:
extends: yin
x: += 50
```

See the `use_layout` sample found [here](https://github.com/andymeneely/squib/tree/master/samples/)

{include:file:samples/use_layout.rb}
Expand Down

0 comments on commit 67741f7

Please sign in to comment.