Skip to content

6. Keeping things clean

Sébastien Lavoie edited this page Jul 1, 2018 · 1 revision

Using IDs

Now that's we've gone though the basics of outlining content for Hyle, you might realize that it would easily get messy with bigger and more complex files. Hyle has many tools under the hood to stay DRY and help us keep our outlines clean and short.

We have yet only referenced items and layers with their name and this can quickly get risky. IDs will fixe that.

layers: 
  - name: Some Layer
    id: 1
  - name: Child layer
    parentLayer: 1

Overwriting defaults

Hyle has its own default values, here's how to overwrite them.

defaults:
  items:
    name: A default name
    layers:
      fontSize: 50
      transform: 
        anchorPoint: 
          expression: "[width/2, height/2]"
        position: [0, 0]

Inheritance

Inheritance will get handy when you'll need to create many items/layers without directly modifying the defaults.

layers:
  - type: Text
    id: 1
    text: Some text
    font: Helvetica Neue
    fontSize: 60
    transform: 
      scale: [50, 50]
  - inherit: 1
    text: Different text

Clone this wiki locally