Skip to content

How to inherit properties with YAML anchors

Published: at 04:58 AM

YAML anchors let you copy and reuse parts of your configuration file, making it easier to manage. Here’s how it works:

base: &base
    tag: same tag

child:
    <<: *base
    another key: 10

In this example, the base section is defined with an anchor (&base). The child section uses <<: *base to copy everything from base into child, and then you can add more properties like another key. This way, you don’t have to repeat the same information in multiple places.


Previous Post
Introduction to NPX